Support » Plugin: WPAdverts - Classifieds Plugin » There are no ads matching your search criteria.

  • Resolved getyler3

    (@getyler3)


    On any category page, the Classifieds widget shows “There are no ads matching your search criteria.” and obviously no ads. Works fine on any other post or page. Have you seen this before? Didn’t see anything posted specifically about this. Thanks!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    it seems the Ads query is somehow customized when the user is on /articles/recipes/ page.

    You can try to prevent this by adding the code below in your theme functions.php file

    
    add_filter( "adverts_widget_list_query", function( $args ) {
      $args["suppress_filters"] = 1;
      return $args;
    } );
    
    getyler3

    (@getyler3)

    Thanks Greg. Doesn’t work though. It’s not just /articles/recipes, it’s every category page. Regular pages and posts are fine. Any other ideas?

    Plugin Author Greg Winiarski

    (@gwin)

    I am not sure the suppress_filters argument should disable all the additional filters which change the results set.

    What you can do is open file wpadverts/includes/class-widget-ads.php and on line about 484 after $loop = new WP_Query( $params ); add the code below

    
    echo "<pre>";
    print_r( $loop );
    echo "</pre>";
    

    then refresh the page it should print some additional debug information in the Recent Ads widget, you can copy the debug information and paste it here.

    Once you do that remove the added code from class-widget-ads.php

    getyler3

    (@getyler3)

    WP_Query Object
    (
    [query] => Array
    (
    [post_type] => advert
    [post_status] => publish
    [posts_per_page] => 5
    [paged] => 1
    [s] =>
    [meta_query] => Array
    (
    )

    [tax_query] => Array
    (
    [0] => Array
    (
    [taxonomy] => advert_category
    [field] => term_id
    [terms] => Array
    (
    [0] => 477
    [1] => 474
    [2] => 491
    [3] => 479
    [4] => 476
    [5] => 475
    [6] => 490
    [7] => 489
    [8] => 488
    [9] => 518
    [10] => 487
    [11] => 480
    [12] => 478
    [13] => 511
    [14] => 486
    )

    )

    )

    [orderby] => Array
    (
    [menu_order] => DESC
    [date] => DESC
    )

    [meta_key] =>
    [menu_order] =>
    [suppress_filters] => 1
    )

    [query_vars] => Array
    (
    [post_type] => Array
    (
    [0] => post
    [1] => wpautoterms_page
    )

    [post_status] => publish
    [posts_per_page] => 5
    [paged] => 1
    [s] =>
    [meta_query] => Array
    (
    )

    [tax_query] => Array
    (
    [0] => Array
    (
    [taxonomy] => advert_category
    [field] => term_id
    [terms] => Array
    (
    [0] => 477
    [1] => 474
    [2] => 491
    [3] => 479
    [4] => 476
    [5] => 475
    [6] => 490
    [7] => 489
    [8] => 488
    [9] => 518
    [10] => 487
    [11] => 480
    [12] => 478
    [13] => 511
    [14] => 486
    )

    )

    )

    [orderby] => Array
    (
    [menu_order] => DESC
    [date] => DESC
    )

    [meta_key] =>
    [menu_order] =>
    [suppress_filters] => 1
    [error] =>
    [m] =>
    [p] => 0
    [post_parent] =>
    [subpost] =>
    [subpost_id] =>
    [attachment] =>
    [attachment_id] => 0
    [name] =>
    [static] =>
    [pagename] =>
    [page_id] => 0
    [second] =>
    [minute] =>
    [hour] =>
    [day] => 0
    [monthnum] => 0
    [year] => 0
    [w] => 0
    [category_name] =>
    [tag] =>
    [cat] =>
    [tag_id] =>
    [author] =>
    [author_name] =>
    [feed] =>
    [tb] =>
    [meta_value] =>
    [preview] =>
    [sentence] =>
    [title] =>
    [fields] =>
    [embed] =>
    [category__in] => Array
    (
    )

    [category__not_in] => Array
    (
    )

    [category__and] => Array
    (
    )

    [post__in] => Array
    (
    )

    [post__not_in] => Array
    (
    )

    [post_name__in] => Array
    (
    )

    [tag__in] => Array
    (
    )

    [tag__not_in] => Array
    (
    )

    [tag__and] => Array
    (
    )

    [tag_slug__in] => Array
    (
    )

    [tag_slug__and] => Array
    (
    )

    [post_parent__in] => Array
    (
    )

    [post_parent__not_in] => Array
    (
    )

    [author__in] => Array
    (
    )

    [author__not_in] => Array
    (
    )

    [ignore_sticky_posts] =>
    [cache_results] =>
    [update_post_term_cache] => 1
    [lazy_load_term_meta] => 1
    [update_post_meta_cache] => 1
    [nopaging] =>
    [comments_per_page] => 50
    [no_found_rows] =>
    [taxonomy] => advert_category
    [term_id] => 477
    [order] => DESC
    )

    [tax_query] => WP_Tax_Query Object
    (
    [queries] => Array
    (
    [0] => Array
    (
    [taxonomy] => advert_category
    [terms] => Array
    (
    [0] => 477
    [1] => 474
    [2] => 491
    [3] => 479
    [4] => 476
    [5] => 475
    [6] => 490
    [7] => 489
    [8] => 488
    [9] => 518
    [10] => 487
    [11] => 480
    [12] => 478
    [13] => 511
    [14] => 486
    )

    [field] => term_id
    [operator] => IN
    [include_children] => 1
    )

    )

    [relation] => AND
    [table_aliases:protected] => Array
    (
    [0] => wp_term_relationships
    )

    [queried_terms] => Array
    (
    [advert_category] => Array
    (
    [terms] => Array
    (
    [0] => 477
    [1] => 474
    [2] => 491
    [3] => 479
    [4] => 476
    [5] => 475
    [6] => 490
    [7] => 489
    [8] => 488
    [9] => 518
    [10] => 487
    [11] => 480
    [12] => 478
    [13] => 511
    [14] => 486
    )

    [field] => term_id
    )

    )

    [primary_table] => wp_posts
    [primary_id_column] => ID
    )

    [meta_query] => WP_Meta_Query Object
    (
    [queries] => Array
    (
    )

    [relation] =>
    [meta_table] =>
    [meta_id_column] =>
    [primary_table] =>
    [primary_id_column] =>
    [table_aliases:protected] => Array
    (
    )

    [clauses:protected] => Array
    (
    )

    [has_or_relation:protected] =>
    )

    [date_query] =>
    [request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND (
    wp_term_relationships.term_taxonomy_id IN (474,475,476,477,478,479,480,486,487,488,489,490,491,511,518)
    ) AND wp_posts.post_type IN (‘post’, ‘wpautoterms_page’) AND ((wp_posts.post_status = ‘publish’)) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order DESC, wp_posts.post_date DESC LIMIT 0, 5
    [posts] => Array
    (
    )

    [post_count] => 0
    [current_post] => -1
    [in_the_loop] =>
    [comment_count] => 0
    [current_comment] => -1
    [found_posts] => 0
    [max_num_pages] => 0
    [max_num_comment_pages] => 0
    [is_single] =>
    [is_preview] =>
    [is_page] =>
    [is_archive] => 1
    [is_date] =>
    [is_year] =>

    Plugin Author Greg Winiarski

    (@gwin)

    Thanks for the print. One strange thing about the query executed on your site is this part wp_posts.post_type IN (‘post’, ‘wpautoterms_page’) it should be wp_posts.post_type = 'advert'.

    In your case the database is not queried for posts with type = advert so the results set will always be empty.

    I am not exactly sure why is that, but i did some digging and it looks like wpautoterms_page is created by WPAutoTerms plugin which seems to be installed on your site. If it is please try disabling it and see if it helps.

    getyler3

    (@getyler3)

    That was it Greg, thanks! Deactivated WPAutoTerms and the ads show up. Thanks for troubleshooting this for me.

    All the best!

    Plugin Author Greg Winiarski

    (@gwin)

    Sure, no problem 🙂

    BTW. If you are finding the plugin useful i would be thankful if you could write a short one or two sentence review here https://wordpress.org/support/view/plugin-reviews/wpadverts

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘There are no ads matching your search criteria.’ is closed to new replies.