Wordpress检查post ID是否存在
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress检查post ID是否存在相关的知识,希望对你有一定的参考价值。
Thanks to Tom McFarlin for this.http://tommcfarlin.com/wordpress-post-exists-by-id/#more-30264
<?php /** * Determines if a post, identified by the specified ID, exist * within the WordPress database. * * Note that this function uses the 'acme_' prefix to serve as an * example for how to use the function within a theme. If this were * to be within a class, then the prefix would not be necessary. * * @param int $id The ID of the post to check * @return bool True if the post exists; otherwise, false. * @since 1.0.0 */ function acme_post_exists( $id ) { } ?>
以上是关于Wordpress检查post ID是否存在的主要内容,如果未能解决你的问题,请参考以下文章
Wordpress REST API:如何检查 id 是不是存在于 url