我使用的模板使用以下方式输出帖子的日期:
echo get_the_date( get_option( \'date_time\' ) );
我想知道为什么这个输出现在(升级到WP 5.5后)不再工作了?快速修复正在使用该选项date_format
:
echo get_the_date( get_option( \'date_format\' ) );
我调查了Wordpress开发者https://developer.wordpress.org/reference/functions/get_the_date/#source 看起来,如果“date\\u time”选项为空,它也会起作用:function get_the_date( $format = \'\', $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
if ( \'\' === $format ) { // <-- check for empty value
$the_date = get_post_time( get_option( \'date_format\' ), false, $post, true );
} else {
$the_date = get_post_time( $format, false, $post, true );
}
return apply_filters( \'get_the_date\', $the_date, $format, $post );
}
Why does the output of get_the_date(get_option(\'date_time\'))
in the template doesnt work with Wordpress 5.5?