To add back the filters that were removed you’d have to know what was hooked in originally in the first place. You could crawl the global
$wp_filter
array, but this should do the same at far less effort:
function remove_query_order($order) {
remove_filter('posts_orderby','remove_query_order',PHP_INT_MAX);
return '';
}
add_filter('posts_orderby','remove_query_order',PHP_INT_MAX);
Add the filter before the query you want it to effect and it will remove itself.
Related Posts:
- AJAX with loop filtering categories
- Exclude filter on front page
- Filtering The Loop For Single Page and Blog Page
- Sort Posts By Category?
- Custom search form to display users only
- How to get an array of years from all of the search results, and use it to filter by year the paginated loop?
- Query posts if meta key starts with
- How to return only one instance of each, from the entire loop
- Query reset problem or flawed code to enable custom post type query
- Combining action and filter?
- Filter the loop by categories using checkbox form
- Filter the_posts doesn’t work on search page
- Trying to get property of non-object in shortocde
- Make a loop to return x number of posts, but only if they have content or excerpt
- Filter existing hook using parameter and foreach loop
- Loop order issue with Ajax filter
- Add Search and Filter functionality to custom loop
- Reorder posts in a loop: have the posts by one particular author below the others
- How to filter get previous post function by meta value DESC and post date DESC?
- WordPress redundant posts based on meta field
- Buddypress Group Activity Loop Filter activity type [closed]
- get_posts and wp_autop (remove filter)
- Help with add_filter(‘the_content’, ‘some_function’) and multiple matches
- Applying a filter to multiple loops for days ago
- Split Content and Gallery
- Redirect loop when trying to login to /wp-admin/ [duplicate]
- Do I need to use The Loop on pages?
- How to list some posts first in the loop based on post id
- How to order posts tag by tag?
- Display all authors and their only one latest post
- Remove comma from last item output from loop
- as a shortcode within the loop?
- Page template not displaying
- Can I use both a custom excerpt and a trimmed excerpt?
- How to get_template_part using AJAX?
- How can I modify the loop from a plugin without wiping out other filters?
- How to track post number on the_loop
- One custom loop with condition to check child posts
- Loop get_theme_mod
- Move sticky posts down in main loop
- Why only one post (and no pagination) on this variation of the loop?
- Separeting product from post in search result
- Loop in Related Posts WordPress
- Conditional query that displays on Woo product attribute pages
- Template structure
- Custom Loop Using Shortcode in Custom Page Template
- Listing subpages title and content and styling the first iteration differently
- ajax for filtering posts by category in wordpress loops
- single.php – how to mark current page in the loop
- Cannot retieve the_content() and the_author() – both returning empty strings
- How to order by multiple fields using standard query_posts?
- Get 1 more post in loop
- How to get the excerpt for is_home() outside of the loop isn’t working
- Make loop alphabetical
- How to check if a product is purchased within the last 365 days before displaying something
- How do I get my loop.php to properly paginate?
- How to display first post
- Pagination on custom post type on front-page.php
- get_template_part() Not Working in Loop
- get_delete_post_link() inside Loop stubbornly returns nothing
- CPT while loop not working
- Problem with Front-Page.php loading recent posts
- Comments_template doesn’t work
- Get markup for post without loading into the template
- Where to add offset?
- How to synchronize The Loop with the max post per page?
- How to add a byline to all the pages?
- Exclude posts based on an array
- Displaying member join date on page
- Ascending order has strange effects on wordpress loop
- List ALL posts by author on author archive
- Get current taxonomy and display query accordingly
- get post images to link to external sources
- Using is_page_template inside loop
- WordPress Ajax filter: Create two loops for different output styles?
- How to show the last article in a different way in my blog?
- Can’t limit posts_per_page in loop
- How to append the excerpt to the content in the single post page?
- Slug is changing when I use WP_Query in a metabox of a post
- Custom loop not working in singular.php, working in other pages
- Loop Posts Outside of WordPress Installation
- Link Button url count php and wordpress
- Posts are being displayed from old to new, in ascending order
- Set loop format & have a loop inside other one
- Need a conditional to test if title of parent page matches title of child page
- Query counting excluded category on paged loop
- Using shortcode within shortcode with dynamic variable
- modify default HAVE_POSTS() Loop without inserting new variable (i.e. $loop->HAVE_POSTS)
- Display articles related to a custom field on a page
- Why is my pagination showing up?
- Changing the loop w/o killing category links
- Randomly Display One Image From a 10-Image For Loop
- An action that runs after each post in the loop on index/archive page?
- Modify my code – which takes the first sentence of the post and use it as a h2 tag – to work outside the loop
- Getting post id in for loop
- Different style for first two (sticky) posts
- pull 500 post of many from database [duplicate]
- WordPress loop put title into variable
- How do I display 3 post each in a bootstrap carousel?
- Multiple loops using next_posts_link & previous_posts_link