如何在Wordpress中检查帖子是否已更新?
if (post_has_edit())
the_modified_time();
else
the_time();
是否有类似post_has_edit()
的函数
From Wordpress docs:
如果帖子或页面未被修改,则修改时间与创建时间相同。
所以你可以只使用the_modified_time()
,如果文章没有被修改,它将返回创建时间。
查看帖子是否被修改,查看the_modified_time() == the_time()
.
如果您需要检查date
多个post在同一页面(例如:存档页面,搜索页面或任何WP_Query
),您可以使用
if(get_the_modified_date == get_the_date) :
// Do stuff here
endif;
并且记住使用!=
for is not equal:)