Introduction
The message timestamps in BuddyBoss may not follow the time format set in your WordPress settings. You can fix this by adding a custom function to your active theme. This guide explains how you can fix the time format on BuddyBoss messages.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- In your WordPress admin dashboard, go to Appearance > Theme Editor.
- Under Select theme to edit, choose your active theme (preferably BuddyBoss Child Theme), then click Select.
- From the Theme Files list, click Theme Functions (functions.php).
- Paste the following code just before the closing PHP tag (?>):
function bb_change_time_format_to_wp_time( $site_sent_date ) {
if ( function_exists( 'bp_get_the_thread_message_date_sent' ) ) {
$sent_date = bp_get_the_thread_message_date_sent();
$sent_date_formatted = wp_date( 'Y-m-d h:i:s', $sent_date );
$site_sent_date = get_date_from_gmt( $sent_date_formatted );
$time_format = get_option( 'time_format' );
$time_format = ! empty( $time_format ) ? $time_format : 'g:i a';
$site_sent_date = wp_date( $time_format, strtotime( $site_sent_date ) );
}
return $site_sent_date;
}add_filter( ‘bb_get_the_thread_message_sent_time’, ‘bb_change_time_format_to_wp_time’, 99, 1 );
- Click Update File to save your changes.
Troubleshooting and FAQs
Q: The message time is still incorrect, what should I check?
A: Make sure the code is added to the active theme’s functions.php and clear any caches.
Q: Can I change the time format?
A: Yes, update the WordPress Time Format under Settings > General, or modify the $time_format value in the code.
Q: Will this affect other areas of the site?
A: No, this change only affects message timestamps.
Q: Can I revert this change easily?
A: Yes, remove the code from functions.php and save.
Q: Who can I contact for further assistance?
A: Check the BuddyBoss Support Policy or consult a developer.