• Resolved mmrizmy

    (@mmrizmy)


    Hi.
    I have installed this plugin and it works really great.
    One small thing. When the user types nothing and clicks on search. I would like to show nothing found page. Can this be done?

    Right now, when the user just presses enter or clicks search, All the products are shown.

    —————————————————————

    Also, is it possible to hide the author?

    • This topic was modified 5 years, 1 month ago by mmrizmy.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    That was the original behaviour, but after plenty of complaints, Relevanssi was changed to return all the results like WP default search does.

    Adding this to your theme functions.php will produce a “nothing found” page if the search query is empty:

    add_filter( 'relevanssi_search_filters', 'rlv_empty_search', 10 );
    function rlv_empty_search( $args ) {
    	if ( empty( $args['q'] ) ) {
    		$args['q'] = 'gdfkjgdkfgdfgdfgdf';
    	}
        return $args;
    }

    Hide the author? If you mean on the search results page, the answer is yes, but it’s up to your theme, Relevanssi isn’t responsible for that. You need to edit your search results template.

    Thread Starter mmrizmy

    (@mmrizmy)

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Empty search field results’ is closed to new replies.