You cannot declare multiple functions with same name in PHP. Codex examples for this are technical demonstration, rather than ready-made usable snippet.
Give your filter functions unique names, that are not likely to clash with your own or third party code.
Related Posts:
- Filter post query to only show direct children of category
- When should you use WP_Query vs query_posts() vs get_posts()?
- Wp get all the sub pages of the parent using wp query
- How to query for most viewed posts and show top 5
- WP_Query vs get_posts
- What is the most efficient way of querying posts based on visits and date for current day?
- Query Custom Meta Value with Increment
- Get posts by meta data OR title
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- Pass the same object to multiple widgets in a template with one query
- Retrieve or Query Pages by ID
- How do you query wordpress posts using a math formula between multiple meta field values?
- Page navigation doesn’t show when query category
- What is considered a default query for the request filter?
- How to orderby meta_value_num with dollar ($) sign
- Query total number of posts
- How to query a custom post type with a taxonomy filter but display post type archive page?
- Change query_posts to WP_Query in page but does not work
- Custom Query num_rows returns wrong amount
- Bypass “supress_filters” in WP Query
- How to use the query hook/filter?
- Slow page loads due to WordPress Core Query
- Filter posts in category archive page by year using a dropdown
- Add class to first post in custom loop using post_class filter
- Query Page Content From Theme Options?
- How can I override one post and make it display content for another post?
- Include current post into loop
- Filter Custom Taxonomy Posts
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Should I reset $wp_query?
- Why doesn’t my WP Meta Query return any results?
- filter posts by meta key with pagination
- Filter products on category AND tag
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- pre_user_query vs pre_get_posts
- Get posts that match defined arrays of tags
- Query Posts | Combining multiple form inputs into query arguments to generate one filter result
- Sorting query_posts() with a complex orderby filter
- I need query_posts() to order results first by a meta value and then by post ID
- How to show post title in content editor in backend?
- My entry results are not consistently alphabetized
- Merge two queries and remove duplicate
- Fetch only categorized posts
- Ordering Posts by parent category, name ascending
- Optimising specific Query with ACF meta objects
- How to organize a WP_Query’s list of posts by category and display category title?
- When should you use WP_Query vs query_posts() vs get_posts()?
- query post based on comparison
- How to query post ids liked by the Author
- WordPress Query showing multiple titles
- Query Posts by date range with fixed beginning and end
- custom query to get posts
- Get WP_Query query after execution?
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- How to list some posts first in the loop based on post id
- Custom WP_Query order by post_meta and (author) user_meta
- WordPress Custom Query to show posts from last x years
- How to order posts tag by tag?
- Overriding The Loop with filter or hook
- How to support multiple search terms query within one process?
- WP_query category__in not working, only pulls from first category
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Exclude posts with empty post_content in wp_query
- Custom category search box for WordPress
- Query with a meta value inside a given range
- Query all published post AND attachment with specific mime type
- add_filter() depending on search term
- How do I run through a WordPress loop called from a filter function?
- How to display user order by role
- WP Query related posts by tags
- Order by summing multiple values
- Check if loop has any categories?
- Exclude All Posts Which Do Not Have A Tag Assigned
- pre_get_posts – Trying to get property of non-object warning
- WordPress query posts with multiple post_meta data
- Is it possible to add an argument to a custom function added to a filter hook?
- complex get_posts() query to select child pages
- Insert images into wordpress post with a query
- WP_Query meta compare must include ALL array values
- How to query for a page, get data, then query for child pages of that page
- meta_query weird behaviour, static int will work, but not user data
- Query post ordered by meta value that show first post that contained a tag
- Adding nofollow to all the post links in get_posts with pre_get_posts or WP_Query
- get term objects and post objects in query
- How to show terms from another taxonomy
- Ignoring ‘a’ when sorting posts
- WP Query Relations / Compare
- Issue generating custom filter for cpt admin columns
- How to order by datediff in WP loop?
- Custom query for tag and custom tag from 2 post type
- wpdb get_results() returns only 2 rows
- WP_Query secondary query failing
- Search Functionality broken by the wp 4.2 update
- Issue attempting a wp_query_posts with tags
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Get the number of rows from $wpdb->get_results not working
- Pre_get_post on CPT archive page
- I need to get all categories from a WP_Query
- How to get posts that have certain meta key value and order based on another meta key’s value