We recently discovered an issue on a client site using Edit Flow 0.8 and bbPress where any bbPress activity rendered in a status feed would disappear if the ‘Custom Status’ module of Edit Flow was enabled. This Edit Flow and bbPress conflict didn’t occur with version 0.7.6 so we investigated 0.8 to resolve the issue.
After some more digging I found that the line breaking everything is here:
File: edit-flow/modules/custom-status/custom-status.php
Function: fix_custom_status_timestamp($data, $postarr)
Line: 1332
Although the function has been updated it has not been commented/documented. If you hide/remove this part everything works:
1 2 3 4 |
if( empty( $_POST['aa'] ) ) { $data['post_date_gmt'] = '0000-00-00 00:00:00'; return $data; } |
Basically what is happening is that the status post_date_gmt is being overwritten as this part of the function fires on a filter (wp_insert_post_data). Luckily we don’t have to fork or hack the core of Edit Flow to fix this, we simply apply another filter to our functions.php that runs after, as follows:
1 2 3 4 5 6 |
add_filter('wp_insert_post_data', function ($data, $postarr) { if ($data['post_date_gmt'] == '0000-00-00 00:00:00') { $data['post_date_gmt'] = $data['post_date']; } return $data; }, 12, 2); |
This will make sure the bbPress activity status has the right post_date_gmt stored and appears in your status feeds correctly.