How can I modify my query in order to exclude certain posts by slug?
Is it possible?
query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1));
Ty
How can I modify my query in order to exclude certain posts by slug?
Is it possible?
query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1));
Ty
You must be logged in to post a comment.
You can get the post ID from the slug with the
url_to_postid()
function:then just exclude the ID from your query:
You can create an array of post IDs if you need to exclude multiple pages.
Do not use
query_posts()
!. Filterpre_get_posts
instead *.* No, really: don’t use
query_posts()
. Here’s why.