Is it possible to change "X Hours Ago" to date in WP Admin?
Edit:
This seems to work except for one thing. It says the date fine, but then it says " ago" so it shows "Feb 16, 2022 ago". Any advice?
code
function wpse_time_diff_mins( $since, $diff, $from, $to ) {
return wp_date('M j, Y', $from);
}
add_filter( 'human_time_diff', 'wpse_time_diff_mins', 10, 4 );
code
Is it possible to change "X Hours Ago" to date in WP Admin?
Edit:
This seems to work except for one thing. It says the date fine, but then it says " ago" so it shows "Feb 16, 2022 ago". Any advice?
code
function wpse_time_diff_mins( $since, $diff, $from, $to ) {
return wp_date('M j, Y', $from);
}
add_filter( 'human_time_diff', 'wpse_time_diff_mins', 10, 4 );
code
- 2 Do you have an example of where you see that? Off hand, I can't think of anywhere. – Kevin Marsden Commented Dec 12, 2021 at 6:51
- Yes, it is when you are viewing orders in Woocommerce @KevinMarsden. I think in most places though, but you don't see it as frequently because you normally don't make so many posts a day. Probably comments too. – Digital Lion Commented Dec 12, 2021 at 20:08
1 Answer
Reset to default 0On the WooCommerce Orders admin page, the order date column is set on line 256 of this file:
../wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php
If you want to change "ago" you can translate it. If you want to change the human readable time (e.g. "10 hours"), you can override the WordPress human_time_diff function. This answer has more details.