我在wordpress中插入帖子,我得到了一个额外问题。
示例数组
[
'post_title' => 'Hi there',
'post_content' => 'Hi there',
'post_date' => '2016-12-01 12:00:00',
'post_status' => 'publish'
]
当我使用wordpress编辑器进入编辑帖子时,我看到日期不同,我填写并替换为实际日期。
我想在插入帖子时保留原始post_date
。
如何解决此问题?
谢谢,
雅斯特尔
答案 0 :(得分:1)
您可以使用此功能
获取修改日期<?php get_the_modified_date( $d ); ?>
并直接显示修改然后使用此功能
<?php the_modified_date( $d, $before, $after, $echo ); ?>
了解详情https://codex.wordpress.org/Function_Reference/get_the_modified_date
和https://codex.wordpress.org/Function_Reference/the_modified_date
或者您想要发布日期然后使用此功能,
<?php the_date( $format, $before, $after, $echo ); ?>
了解详情https://codex.wordpress.org/Function_Reference/the_date
我希望它会帮助你