最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is it possible to change X Hours Ago to date in WP Admin?

programmeradmin1浏览0评论

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

Share Improve this question edited Feb 17, 2022 at 2:03 Digital Lion asked Dec 12, 2021 at 1:12 Digital LionDigital Lion 11 bronze badge 2
  • 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
Add a comment  | 

1 Answer 1

Reset to default 0

On 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.

发布评论

评论列表(0)

  1. 暂无评论