get_the_date
最后更新于:2021-11-26 23:49:07
apply_filters( ‘get_the_date’, string $the_date, string $format, int|GC_Post $post )
Filters the date a post was published.
参数
- $the_date
-
(string)
The formatted date. - $format
-
(string)
PHP date format. - $post
-
(int|GC_Post)
The post object or ID.
源文件
文件: gc-includes/general-template.php
add_action( 'get_the_date', 'my_project_filter_publish_dates', 10, 3 ); function my_project_filter_publish_dates( $the_date, $d, $post ) { if ( is_int( $post) ) { $post_id = $post; } else { $post_id = $post->ID; } if ( 'product' != get_post_type( $post_id ) ) return $the_date; return date( 'Y-d-m - h:j:s', strtotime( $the_date ) ); }