WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Relevanssi – A Better Search] No Results after WP Upgrade

[Plugin: Relevanssi – A Better Search] No Results after WP Upgrade

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari
    Participant

    @msaari

    Sounds like you’re using Role-Scoper, in which case the solution is here: http://www.relevanssi.com/release-notes/free-3-0-2/

    nope!

    Ariakan
    Member

    @ariakan

    I have a new installation of WordPress 4.3.1, and it doesn’t work.
    I don’t use Role-Scoper, I only have fiew plugins…

    Plugin Author Mikko Saari
    Participant

    @msaari

    So, your index is correct, and theme hasn’t changed… how about your $wp_query? Get a var_dump() of $wp_query->query_vars when you run a search, maybe there’s a clue there.

    not sure if i did it correctly. i put var_dump($wp_query); after line38.

    Here’s what was returned:

    object(WP_Query)#253 (44) {
    [“query_vars”]=>
    &array(56) {
    [“s”]=>
    string(4) “rice”
    [“error”]=>
    string(0) “”
    [“m”]=>
    int(0)
    [“p”]=>
    int(0)
    [“post_parent”]=>
    string(0) “”
    [“subpost”]=>
    string(0) “”
    [“subpost_id”]=>
    string(0) “”
    [“attachment”]=>
    string(0) “”
    [“attachment_id”]=>
    int(0)
    [“name”]=>
    string(0) “”
    [“static”]=>
    string(0) “”
    [“pagename”]=>
    string(0) “”
    [“page_id”]=>
    int(0)
    [“second”]=>
    string(0) “”
    [“minute”]=>
    string(0) “”
    [“hour”]=>
    string(0) “”
    [“day”]=>
    int(0)
    [“monthnum”]=>
    int(0)
    [“year”]=>
    int(0)
    [“w”]=>
    int(0)
    [“category_name”]=>
    string(0) “”
    [“tag”]=>
    string(0) “”
    [“cat”]=>
    string(0) “”
    [“tag_id”]=>
    string(0) “”
    [“author_name”]=>
    string(0) “”
    [“feed”]=>
    string(0) “”
    [“tb”]=>
    string(0) “”
    [“paged”]=>
    int(0)
    [“comments_popup”]=>
    string(0) “”
    [“meta_key”]=>
    string(0) “”
    [“meta_value”]=>
    string(0) “”
    [“preview”]=>
    string(0) “”
    [“sentence”]=>
    string(0) “”
    [“fields”]=>
    string(0) “”
    [“category__in”]=>
    array(0) {
    }
    [“category__not_in”]=>
    array(0) {
    }
    [“category__and”]=>
    array(0) {
    }
    [“post__in”]=>
    array(0) {
    }
    [“post__not_in”]=>
    array(0) {
    }
    [“tag__in”]=>
    array(0) {
    }
    [“tag__not_in”]=>
    array(0) {
    }
    [“tag__and”]=>
    array(0) {
    }
    [“tag_slug__in”]=>
    array(0) {
    }
    [“tag_slug__and”]=>
    array(0) {
    }
    [“ignore_sticky_posts”]=>
    bool(false)
    [“suppress_filters”]=>
    bool(false)
    [“cache_results”]=>
    bool(true)
    [“update_post_term_cache”]=>
    bool(true)
    [“update_post_meta_cache”]=>
    bool(true)
    [“post_type”]=>
    string(3) “any”
    [“posts_per_page”]=>
    int(75)
    [“nopaging”]=>
    bool(false)
    [“comments_per_page”]=>
    string(2) “50”
    [“no_found_rows”]=>
    bool(false)
    [“search_terms”]=>
    array(1) {
    [0]=>
    string(4) “rice”
    }
    [“order”]=>
    string(4) “DESC”
    }
    [“tax_query”]=>
    object(WP_Tax_Query)#230 (2) {
    [“queries”]=>
    array(0) {
    }
    [“relation”]=>
    string(3) “AND”
    }
    [“meta_query”]=>
    object(WP_Meta_Query)#231 (2) {
    [“queries”]=>
    array(0) {
    }
    [“relation”]=>
    NULL
    }
    [“post_count”]=>
    int(0)
    [“current_post”]=>
    int(-1)
    [“in_the_loop”]=>
    bool(false)
    [“comment_count”]=>
    int(0)
    [“current_comment”]=>
    int(-1)
    [“found_posts”]=>
    int(0)
    [“max_num_pages”]=>
    float(0)
    [“max_num_comment_pages”]=>
    int(0)
    [“is_single”]=>
    bool(false)
    [“is_preview”]=>
    bool(false)
    [“is_page”]=>
    bool(false)
    [“is_archive”]=>
    bool(false)
    [“is_date”]=>
    bool(false)
    [“is_year”]=>
    bool(false)
    [“is_month”]=>
    bool(false)
    [“is_day”]=>
    bool(false)
    [“is_time”]=>
    bool(false)
    [“is_author”]=>
    bool(false)
    [“is_category”]=>
    bool(false)
    [“is_tag”]=>
    bool(false)
    [“is_tax”]=>
    bool(false)
    [“is_search”]=>
    bool(true)
    [“is_feed”]=>
    bool(false)
    [“is_comment_feed”]=>
    bool(false)
    [“is_trackback”]=>
    bool(false)
    [“is_home”]=>
    bool(false)
    [“is_404”]=>
    bool(false)
    [“is_comments_popup”]=>
    bool(false)
    [“is_paged”]=>
    bool(false)
    [“is_admin”]=>
    bool(false)
    [“is_attachment”]=>
    bool(false)
    [“is_singular”]=>
    bool(false)
    [“is_robots”]=>
    bool(false)
    [“is_posts_page”]=>
    bool(false)
    [“is_post_type_archive”]=>
    bool(false)
    [“query_vars_hash”]=>
    string(32) “e166323807d83784ecc34601d28e7945”
    [“query_vars_changed”]=>
    bool(false)
    [“thumbnails_cached”]=>
    bool(false)
    [“query”]=>
    array(1) {
    [“s”]=>
    string(4) “rice”
    }
    [“request”]=>
    string(32) “SELECT * FROM wp_posts WHERE 1=2”
    [“posts”]=>
    array(0) {
    }
    }

    Kevin Leary
    Member

    @kevinlearynet

    Hey Mikko,

    Hope all is well. I has a similar issue after the recent upgrade. I was messing with query_vars to control the posts_per_page on a search page for a specific post type, and that seemed to kill the search results:

    global $wp_query;
    
    $wp_query->query_vars['posts_per_page'] = 9;
    
    query_posts($wp_query->query_vars); 
    
    if (have_posts()) : while (have_posts()) : the_post();
    
        // Post content here
    
    endwhile; endif; wp_reset_query();

    I was able to fix the issue by moving the logic to a pre_get_posts action, something I should probably have done from the start.

    /**
     * Control the number of search results
     */
    function citz_control_search_results( $query ) {
    	if (
    		$query->is_tax('topic') || (
    			$query->is_search() &&
    			$query->query_vars['post_type'] == 'apprenticeship'
    		)
    	) {
    		set_query_var('posts_per_page', 9);
    	}
    }
    add_action( 'pre_get_posts', 'citz_control_search_results' );

    Either way, perhaps this may shed some light on what is happening for a few people after the recent upgrade. If you’re editing query_vars before Relevanssi get’s a hold of the query (I believe this happens at the posts_request filter) then you may be in for trouble.

    No fault of the plugin author here, we should all be filtering our query in this way whenever possible anyhow.

    P.S. When are you going to standardize that settings page? If your open to contributions I’d love to lend a hand in setting up a tabbed UI that leverages some of the newer WordPress admin standards.

    Plugin Author Mikko Saari
    Participant

    @msaari

    jjust1, nothing in the dump that would explain your problem. Can you put your search results template into a pastebin and show it to me?

    Kevin, the problem is not messing with the query_vars, but the query_posts() function call which is dropping Relevanssi off. But yes, your solution is a clean way to do it, another is to use the post_limits filter, and yet another is to use relevanssi_modify_wp_query filter.

    Any contributions on the settings page are most welcome, I’m not much of an UI developer as you might have noticed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] No Results after WP Upgrade’ is closed to new replies.