Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 799

Set up The Loop with query parameters. This will override the current WordPress Loop and shouldn’t be used more than once. This must not be used within the WordPress Loop.

2 votes
Accepted

How to modify the query to exclude posts by slug?

You can get the post ID from the slug with the url_to_postid() function: $ID = url_to_postid(slug); then just exclude the ID from your query: query_posts(array('category_name' => 'Mycat', 'posts_ …
Dalton Rooney's user avatar
1 vote

Is there a way to exclude the content from the post variable to save on RAM usage?

WP_Query has a "return fields" paramater that looks like this: $args = array( 'fields' => 'ids' ); $query = new WP_Query( $args ); When used this way, WP_Query only returns the post IDs, not the e …
Dalton Rooney's user avatar
3 votes

How to return results of a get_posts() in explicitly defined order

As of WordPress 3.5, this feature is now in core. You can explicitly order posts using the "post__in" parameter. http://core.trac.wordpress.org/ticket/13729
Dalton Rooney's user avatar
5 votes
5 answers
10k views

How to return results of a get_posts() in explicitly defined order

I'm trying to create a loop of explicity ordered posts, for example: <?php $args = array( 'include' => '1,3,8,4,12' ); ?> <?php get_posts( $args ); ?> The results are ordered by date …
Dalton Rooney's user avatar