You can’t concatenate an array onto query_string like that. See Digging Into WordPress’s post about looping for the right format. Alternately, you can use array_merge()
like on the query_posts Codex page.
Consider using wp_reset_query()
after your loop. Sometimes you’ll also see people save the original $query_string
to a new variable, modify $query_string
, and then reset $query_string
after the loop like so:
global $query_string;
$old_query = $query_string
// Modify your query, loop through it
$query_string = $old_query;
Related Posts:
- How to return results of a get_posts() in explicitly defined order
- Modify main WordPress loop with a parse_query filter
- How should I intercept the main query and inject custom join / order by / group by criteria
- Dynamically excluding current page id
- How to order results by date and meta key?
- Static Front-Page Excerpts
- Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?
- query_posts() ALWAYS displays something?
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- Custom loops, sticky posts, and pagination nightmare
- Filter Loop by Custom Field Value
- When to use WordPress loop or Foreach loop?
- Post per page not working if no category specified
- Calling Posts from Specified Cat
- Most Effective Method? Exclude Category and Number of Posts Per Page
- How do I query based on the modified date?
- Script that gets the first tag of post and query all other posts with the same tag
- How to add an “or” instead of and “and” (&) in a WordPress query?
- Modify main loop query for paged and meta key
- Create a Loop with Posts Ordered by Most Recent Comments
- query_posts and sub pages?
- The_content display a different content from a previous loop
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- Including post data in a sidebar occurring outside of and before the Loop
- Multiple loops with / without sticky posts and different post limits
- how to query posts by category and tag?
- How do I query by post format in WordPress 3.1
- How to set posts per page using WP_Query()
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- Custom Post Type “Event”: chronological list of recurring events
- Why is it necessary to call rewind_posts() when using the loop more than once? [duplicate]
- Order by meta value, pro first, then free
- How to create an attachments archive with working pagination?
- how could I get the pagination as I want to when query posts using get_posts function
- Counter code for paginated category pages in wordpress
- Author List page: Exclude based on last post date
- Replace query_posts with pre_get_posts
- query_posts sort in multiple directions
- Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)
- How to get the list of posts in a static page other than front page?
- Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output
- Query for posts in 2 taxonomies
- Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook
- exclude ids through post__not_in
- Exclude category from loop not working
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- Different number of posts on the front page
- Query posts without a specific ID
- Integrating post archive wtih another source and preserving date ordering
- Order posts using a custom array
- Show Only Posts Owned By Logged In User + my post
- Using loop pagination on single.php
- Custom MySQL Query with logic
- Query last updated posts (posts updated in the last 24 hours)
- order posts by meta value on posts page
- Show a Category X’s custom post type on Category X archive page?
- trouble with query to fetch next and previous posts
- Some doubts about how the main query and the custom query works in this custom theme?
- Simple custom post query for all the posts or many of them not working
- Hook to return true when the_post() is used in a custom while loop
- Exclude first post (sticky or not) from the loop using query_posts()
- Proper syntax to add boolean in array()
- get_the_title outputs title until spacing; it does not get full length of title
- How do I rewrite this loop as a new WP_Query style-loop?
- using query_posts to pull posts out of a category in a while loop. Getting odd echo
- Echo a numerical value in query_posts
- why to use query_posts() in custom page?
- Query posts to get all but the most recent post
- Always using the same ARRAY on different querys
- Include current post into loop
- Display trimmed version of the_post()
- How to only publish posts with image in it
- How to change default post type / post to media or attachments
- How exclude 3 latest posts of a category in query_posts
- query_posts orderby multiple ways
- Pagination linking to first page
- How to break up php code to avoid echo
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Custom template for password protected page
- Weird problem on if statement
- Issue with sidebar widgets not showing when I do custom queries
- Why would post_type be ignored in this query?
- query_posts call sets is_home() to true
- show all in query_posts on category.php?
- Trouble highlighting correct menu parent with wp_nav_menu classes while viewing “single posts”
- Latest 5 post excerpts from 5 different authors in Sidebar
- Custom Post Types Not Showing Up In query_posts Result
- Pre-existing arguments when using queries
- Get a Post Loop based on Logged in User information into a Shortcode
- Help with query_posts function
- Group posts in a category based on tags in custom taxonomy
- Can I show some specific post rather than latest post?
- get_posts and wp_autop (remove filter)
- Multiple post queries -category,posts per page,orderby
- Multiple loop for “featured” items returns wrong posts
- Query Posts (post meta)
- get all posts with certain meta data
- show custom post’s post in two different divs [duplicate]
- How do I find the first item in the post array?