• I’m using both WP Ultimate Recipe and Search Everything plugins, and everything was OK until recently when I discovered that the detailed search widget in WPUR, was systematically sending empty results back. Investigating further, I determined that the problem disappeared when deactivating Search Everything.

    I looked into the code for the WPUR widget, and it basically uses the ‘pre_get_posts’ hook to modify the query based on the different values of searched taxonomies that were set using the widget, and retrieved from the url thanks to a GET method.

    I joined the callback’s code below.

    Do you see a possible workaround on your side for this kind of issue ? Would it be possible for the plugin to recognize that it’s a “custom” search query, and in this case don’t activate itself ?

    Or would there be a better solution on WPUR plugin side ?

    Regards,

    Pascal.

    public function pre_get_posts_search( $query )
    {
    if( $query->is_search && isset( $_GET[‘wpurp-search’] ) )
    {
    // Only search for recipes
    $query->set( ‘post_type’, ‘recipe’ );

    // Check taxonomy filters
    $tax_query = array();
    foreach( $_GET as $tag => $term )
    {
    if( substr( $tag, 0, 7 ) == ‘recipe-‘ && $term != ‘0’) {
    $tax_query[] = array(
    ‘taxonomy’ => substr( $tag, 7 ),
    ‘field’ => ‘id’,
    ‘terms’ => array( intval( $term ) ),
    );
    }
    }
    if( !empty( $tax_query ) ) {
    $query->tax_query->queries = $tax_query;
    $query->query_vars[‘tax_query’] = $query->tax_query->queries;
    }
    }
    return $query;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pscolv

    (@pscolv)

    Update to this post : I investigated a bit more, using the Query Monitor plugin, and it appears that there is a SQL error whenever the faceted search runs with Search Everything activated. You can find the details of the issue in the attached screen capture :
    SQL error

    Looking at it, the issue seems to be related to the string “AND ((()))” in the middle.

    Thanks for your support there,

    Regards,

    Pascal.

    Thread Starter pscolv

    (@pscolv)

    Latest update !
    I tried the following hotfix proposed @marsuby on this forum, since this issue seems to be known already :
    //TODO: Hotfix! with empty search params, se_search_default()='()’
    // leading to an invalid where clause … AND ((()))
    if ( $searchQuery != ” && $searchQuery != ‘()’ ) {
    $where = ‘ AND ((‘ . $searchQuery . ‘)) ‘;
    }

    … and it was successful.

    Hope you’ll be able to incorporate a fix soon in the plugin.

    Regards,

    Pascal.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conflict with WP Ultimate Recipe search widget’ is closed to new replies.