Well you can try and run debug_backtrace();
on your function.
For example:
function wpse_82183_debug( $query ) {
//your query goes here, this is just a basic one
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'posts_per_page', 1 );
//magic happens here
var_dump(debug_backtrace());
}
}
add_action( 'pre_get_posts', 'wpse_82183_debug' );
There are also a number of plugins that help figure stuff out,
I recently made this list: http://wycks.github.com/WordPress-Gear/ (click debug tools)
Have a look at :
Related Posts:
- Can I force WP_Query to return no results?
- Post_count only shows the number of results per page
- WP Query where title begins with a specific letter
- Display products from specific category in shop page
- Search custom taxonomy term by name
- Order Search Results Page by meta_value If no Value Return Remaining Results
- Show all products on one page with WooCommerce
- Want to redirect if search query match exact title of any post
- Pagination not working for Custom search form & custom result template
- How to support multiple search terms query within one process?
- Pagination broken when merging search results with additional WP_Query
- Custom search form with empty parameters
- How to search by title or tags exclusively?
- WordPress search exact match
- Pagination wont work with search results template [duplicate]
- How do I search WordPress by different fields without a plugin?
- Multiple keyword search
- Using next/previous_posts_link with customised search
- WordPress custom search form with pre_get_posts not work
- Search – Ajax – Alter Query Parameters with Pagination
- Add custom search results to main WP search [duplicate]
- Woocommerce custom loop to show all the products [closed]
- Multiple search queries on one page
- tax_query shows no results if nothing is selected
- Searching through different categories on different pages code is not working
- WP Query search for attachments and their exact title
- WP_Query’s “request” SQL Query
- Including only current user’s posts in search
- Searching not only by post name but also category
- $wp_query->found_posts not returning correct value
- How to search by slug and old slug in single API
- WordPress search WP_Query to cover multiple post types and their custom fields?
- How to search post titles with whole words only, but not the exact word only?
- My combination of ‘post_type’ and ‘tax_query’ not working?
- How to prevent WP_Query from filtering on ‘s’ but keep ‘s’ for other purposes?
- Block internal search queries with pre_get_posts and regex rules
- Add dynamic search to paginated WP_Query
- How to make the WP query search for the “s” arg in other places too
- Search Exact on WordPress – Relevannsi Solution Not Working
- Excluding posts from search results page with meta query not working
- Pagination repeating posts on search results
- I have problems with the search query using multiple post types
- WP_Query no result if keyword contains number
- Multiple WP_Query args combinations according to post type
- Categories In English version showing not canonical URL, instead shows query search result
- Filter admin ajax data by url query
- How to extend WP_query to a specific table?
- Display the search results like the original pages
- How to use jQuery validation to set the search bar to accept only a specific input?
- Display Search Results by tag_ID in my search.php
- How to debug none working search query?
- getting posts by tags
- Add to search posts query array with post IDS which will appear first
- Custom Post Type WP_Query with filters and search
- Search with WP_Query, but ignore href URLs in anchor tags?
- WordPress search page pagination displaying but not functional
- Search has query that will return no results
- WP Query – Search in title or author_name
- Limit default Search query to post_title
- Get posts by similar names and categories
- Logging search queries for logged-in users
- How to show terms from another taxonomy
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- Order & Orderby clause not working with custom query
- How can I modify standard search query to include also ACF custom fields values?
- A very strange problem with search query
- History of page, interval of years
- Search format not matching taxonomy query
- How to make the default WordPress search return borader results
- Search Functionality broken by the wp 4.2 update
- WordPress WP_Query offset parameter not working with search parameter
- Custom search (wp query by custom fields)
- WordPress WP_Query Array Custom search via taxonomies
- Custom Search Query – include only custom fields and title
- $wp_query when new WP_Query
- Need help setting up a search form for wordpress [duplicate]
- Search Query that Includes Custom Table
- Manipulating a query
- Custom search: Search posts but display parent page in results
- Do not show a custom post if it belongs to a certain custom taxonomy
- Query posts by custom fields
- Searching in specific custom post type
- Search (Custom Form, Custom Search Result)
- Help with showing text when something is entered in my search bar
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- query only direct child and sub-terms of a current term archive
- Filtering product search results using tags
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- How does Show Posts based on a keyword search work in WP_Query
- Search query alteration not working for meta values
- Search results stuck on page 1
- Custom Taxonomy in custom REST API search
- Advanced Search – Is this possible?
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string
- AJAX multiple search boxes not merging with array merge
- Removing filename searches when searching attachments
- Modify WordPress Search
- Rewrite URL custom search query