Tag Archives: get_post_by_slug

WordPress Get Post by Slug(post_name)

需求: 依照Slug获得Post.

解决方案: API只有getPost(by ID), 我们要创建一个getPostBySlug. (Slug具有唯一性, 可参见表wp_posts,post_name 及有关代码)

More…

Posted in Blog小技巧, PHP | Tagged , , , | Leave a comment