Introduction
The BuddyBoss messaging feature does not currently include a built-in option to customize how time and date formats are displayed. To adjust this behavior, custom code is required. As a workaround, you can apply a custom function that syncs the message date and time format with the settings defined in your WordPress dashboard. This guide explains how to change the time and date format in messaging.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- Go to Appearance > Theme Editor in your WordPress admin dashboard.
- Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
- From the Theme Files list, open Theme Functions (functions.php).
- Add the following code just before the closing PHP tag (?>):
function bb_change_date_format_to_wp_date( $output ) {
$date_format = get_option( 'date_format' );
if ( empty( $date_format ) ) {
return $output;
}
return date_i18n( $date_format, strtotime( $output ) );
}
add_filter( 'bb_get_thread_start_date', 'bb_change_date_format_to_wp_date' );
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 the changes.
Once the code has been added successfully, navigate to WordPress Admin > Settings > General. From there, update your preferred Date Format and Time Format. The messaging timestamps will now reflect those settings.
Troubleshooting and FAQs
Q: Where do I change the date and time format after adding the code?
A: Go to Settings > General in your WordPress dashboard and update the Date Format and Time Format fields.
Q: Will this affect other parts of my site?
A: Yes. The formats used here are pulled from the global WordPress date and time settings, which may also affect other areas that rely on those settings.
Q: Does this apply to existing messages?
A: Yes. Existing message timestamps will display using the updated format.
Q: Is this officially supported by BuddyBoss?
A: No. This solution is a custom workaround and not part of the default BuddyBoss feature set.