WordPress.org

Ready to get started?Download WordPress

Forums

SearchAutocomplete
[resolved] Support for Relevanssi (4 posts)

  1. Flector
    Member
    Posted 1 year ago #

  2. Flector
    Member
    Posted 1 year ago #

    find solution, replace code:

    $tempPosts = get_posts( array(
    				's'           => $term,
    				'numberposts' => $this->options['autocomplete_numrows'],
    				'post_type'   => $this->options['autocomplete_posttypes'],
    			) );

    with

    if (function_exists("relevanssi_do_query") ) {
    			$query->query_vars['s'] = $term;
    			$query->query_vars['posts_per_page'] = $this->options['autocomplete_numrows'];
    			$query->query_vars['post_type'] = $this->options['autocomplete_posttypes'];
    			relevanssi_do_query($query);
    			$tempPosts = $query->posts;	}
    		else {
    			$tempPosts = get_posts( array(
    				's'           => $term,
    				'numberposts' => $this->options['autocomplete_numrows'],
    				'post_type'   => $this->options['autocomplete_posttypes'],
    			) );
    		}
  3. hereswhatidid
    Member
    Plugin Author

    Posted 1 year ago #

    I'll look at adding this in an upcoming release. Thanks for the code!

  4. jon509tech
    Member
    Posted 1 year ago #

    I'm using this code on one of my projects now, and it works great, thank you Flector!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic