Your question is incomplete and you have omitted all the context for some weird reason.
I hope we agree that query_posts()
is a bad idea. There’s enough been said on it:
When to use WP_query(), query_posts() and pre_get_posts
Having said that, have you tried wp_reset_postdata
, wp_reset_query
or rewind_posts
? I have no idea what you are doing here, but you can read this and figure which one to use:
http://digwp.com/2011/09/3-ways-to-reset-the-wordpress-loop/
Related Posts:
- Manually set global $post vars with an ID, in order to use template tags
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- Ways to have multiple front-page.php templates that can be swapped out?
- Output before and after the loop
- Define Function in functions.php or plugin and call in theme loop
- How can I let users to access plugin functions based on roles?
- Template for custom post type shows all posts instead of just one
- Fastest way to loop through all posts?
- How does WordPress ensure plugins run at the same time and how does it solve a plugin’s dependency on another one?
- post expire after x days
- Can’t get custom posts of taxonomy to show
- Reset WordPress website
- Display content from custom post type if match to main post category
- how do i remove posts from a WP_Query so the pagination is right?
- Override global query results without hooks
- Use wordpress functions in another PHP file
- Fetch Children of Grouped Products Inside WooCommerce Product Loop
- Insert content of a post into another
- Problem with the Loop – want to limit the access to three free articles
- WordPress Plugin manipulate have_posts()
- Get User_id outside wordpress,
- Calling the_excerpt from inside a plugin template file
- Recent posts per category loop?
- Import Instagram post to WordPress blog post
- Bulk update wordpress posts
- How to get a list of bundled products using wp_query in woocommerce
- Where to find the code used to render a page that has a shortcode and a template defined?
- Loop in elementor custom widget not working
- get_users(); Is an Undefined Function When Used in Cron Job
- Trying to add_action in a loop
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Get post content from outside the loop with plugin shortcode usability
- Price comparison table based on Custom Post Type?
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- Remember the Meta Value With Radio Buttons
- Output after specific post in the loop
- Plugin is creating posts twice
- Polldaddy doesn’t show up on own theme
- Add custom PHP and HTML to the_content()
- Multiple images per post – Show random image elsewhere
- How to modify the Loop from a plugin (instead of a theme)
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
- Create post loop that displays pages by cat ID
- Place content inside the Post Loop
- Displaying image from a repeatable group
- Multiselect value in wp_query
- Advanced Custom Fields (ACF) Plugin – Random Image in Sidebar
- ‘all’ hook and add_action issue (class based plugin)
- Fake Single WordPress Post (Page) Loop
- Alter the reset password link
- single.php fires more than once after clicking on any post to view with different post id each time
- How do i use postMash to order posts in a custom loop?
- How can I save a setting field with multiple checkbox options generated by a foreach loop on a custom wordpress admin page?
- Getting Post Permalink Outside of Loop Not Working
- Is it possible to send user new password after they clicking on forgot password in word press
- Trying to display posts but getting the pages as output
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- Outputting custom field query from a plugin to the website header
- How to display content depending on the Woocommerce Product Category
- Page with redirect
- FacetWP custom display based on post type [closed]
- Add category selection to custom post type (plugin)
- How to install plugin only from PHP file?
- Install and Update plugins on a VPS WordPress installation
- WordPress update and plugin install not working
- add_filter doesn’t work
- Plugin can not display in my custom theme
- How to get post ID with hooks publish_post, new_to_publish, etc
- AJAX call – failling to call do_action
- Change the display of Settings API (do_settings_sections)
- How do I show a different homepage to logged in and non-logged in users?
- Add menu page issues (permissions & position)
- Check if SEO plugin installed
- My WordPress website was hacked [closed]
- How can I insert thousands of Woocommerce products by batch with PHP? [closed]
- how to insert data in wordpress table usnig jquery ajax
- How to put Word documents online so they can be downloaded, printed and read via a web page? [closed]
- How to use my menu PHP code as sidebar?
- Change plugin name on WordPress repo
- add_action in a custom plugin
- How to add single function for all WordPress hooks
- Plugin init hook fires repeatedly
- WooCommerce search products between price range using WP_Query
- Using wpdb without loading all plug-ins via wp-load.php
- Hack-Proof OR Security in WordPress — is it real?
- Stop WordPress processing Javascript as text
- Add custom text color WordPress 3.9 TinyMCE 4 Visual editor
- ACF: post query, hide duplicate values [closed]
- Is there any hook for theme activation ? or something similar?
- What does making sure “that your theme is WordPress header and footer tag enabled” mean?
- Reference product SKU on WooCommerce confirmation page [closed]
- Jquery plugin not working on single pages
- How to use get_template part in the plugin?
- check if a file in a plugin folder exists from a locale installation
- What are the Best Practises When Using AJAX in Plugin Development?
- register_activation_hook in oop approach
- How can I use get header from within my plugin?
- Can free plugin on WordPress.org site promote pro-version of this plugin?
- Why am I getting a “Call to undefined function curl_init()” when I try to use the Sociable plugin?