Query_Posts Does Not Work If Post_type is not Post
-
All I need and this is not too much to ask is to Query ONE post.
Problem:
It’s not a “post” post_type. It’s a custom post_type named “books”.
Query:
Post id to get = 10;
query_posts(‘p=10’); <= THIS DOESN’T WORK
query_posts(‘post_id’=>10) <= THIS DOESN’T WORKI think I know why. because the function query_posts only searches for posts that are have the “post” post_type.
So I thought.. hey I know how to fix that.
query_posts(‘post_type’ => ‘books’, ‘p’=>10); <= THAT DOESN’T WORK
The query above will query all posts in ‘books’ and ignores the post id.Please, can someone share how they use query posts to query just one post from a custom post_type?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Query_Posts Does Not Work If Post_type is not Post’ is closed to new replies.