Sorry, No Content Matched Your Criteria

Today’s tutorial won’t be long, but will hopefully be a nice little tip. Have you ever been browsing around a website and clicked a link or, more likely, entered a search term, only to be greeted with an empty search results page?

Sorry, no content matched your criteria.

(Note: this is what you’ll see on a Genesis Framework site. Other themes will give you different messages.) Tough luck, right? And maybe a little formal? And brief. Very brief.

Ideally, if someone is searching your site for something which isn’t there, or happens to end up on an archive page with no posts (less likely but it could happen), you want to make it easy for them to keep on looking. The latest default WordPress themes (Twenty Fifteen and Twenty Fourteen) both do this, by adding a search box after the failure message (which is a little more helpful in itself, saying “Sorry, but nothing matched your search terms. Please try again with some different keywords.”).

Screen capture of an empty search results page

However, if you’re on a site with no sidebar, you might end up with something kind of empty, and not helpful, and no easy way to escape, other than going back to a link in the navigation menu and starting over. The example on the left (it’s small, but there’s a larger version toward the end of the post if you really want to see it) is an unmodified version of what you might get with Atmosphere, the latest theme from StudioPress, which I chose for this example because it is a one column theme. I needed this for myself, though, because I’ve modified my own site and it’s currently just one column as well.

Happily, Genesis provides yet another filter which you can modify to suit your purposes: genesis_noposts_text. I’ll show you how I used it, and offer some other options as well.

Option One: Append the Message and Add a Search Box

Here’s what I’ve done on my site. I’m OK with the default text, so I don’t feel like removing it at this time. I’ve just added another sentence to the message, and then my search box:

add_filter( 'genesis_noposts_text', 'leaven_change_search_text_one', 10, 2 );
function leaven_change_search_text_one( $text ) {
	$text .= __( ' Would you like to try again?', 'leaven' );
	$text .= get_search_form( false );

	return $text;
Code language: PHP (php)

Option Two: Replace the Message and Add a Search Box

Another option, if you want the “no content found” message to be a little less formal, maybe, would be to replace that text completely:

add_filter( 'genesis_noposts_text', 'leaven_change_search_text_two', 10, 2 );
function leaven_change_search_text_two( $text ) {
	$text  = __( 'This is completely embarrassing. I have no posts to show you. Care to search again?', 'leaven' );
	$text .= get_search_form( false );

	return $text;
Code language: PHP (php)

Option Three: Replace the Message Conditionally (and Add a Search Box)

I think the search box is important, what can I say? The final option I’ll share here changes the “no content found” message, but does so differently for an archive page with no posts ( is_archive() ) than for a search with no results ( is_search() ):

add_filter( 'genesis_noposts_text', 'leaven_change_search_text_three', 10, 2 );
function leaven_change_search_text_three( $text ) {
	if ( is_search() ) {
		$text = __( 'This is completely embarrassing. I have no posts to show you. Care to search again?', 'leaven' );
	} elseif ( is_archive() ) {
		$text = __( 'Evidently I don\'t have much to say on this topic. Maybe you\'d like to search for something else.', 'leaven' );
	$text .= get_search_form( false );

	return $text;
}Code language: PHP (php)

The conditional doesn’t even have to get all that fancy, because this message only shows at specific times.

These are all three fairly basic examples, and similar. You could get fancier, though, and maybe add in an image, or suggested posts, or a personal mea culpa, whatever you like. Here is, hopefully (if my Photoshop tutorial didn’t lead me astray), an animated walk through, from the default, to option three:

Filter the non content found text

That’s it–just a wee tiny filter, but one which can make your empty search results a little less so, and maybe add a bit of pizzazz to an otherwise dull page.

Reader Interactions


  1. Hans Schuijff says

    Thanks for the tip, Robin, its a nice addition.

    Perhaps a bit of topic, but since you wrote here about your choice to not have a sidebar anymore… For myself I’m not sure about getting rid of my sidebars yet. I understand that having no sidebar focusses more on the content and has less clutter, but mostly a sidebar seems to fulfill the function of navigation help and content-advice, and how does one guide visitors to other interesting content in other ways?

    You yourself made sort of a hybrid “no sidebar” website by adding again sort of a floating sidebar inside your content to facilitate just that advice feature, and frankly I would have liked a normal sidebar more, because now it squeezes the content to the side and in smaller windows I have to scroll over that sidebar after already having started reading the article in stead of finding the sidebar content at the end of the article. It’s perhaps an experiment in finding a less cluttered way to guide visitors and offer them navigation options, but it also makes some choices less simple.

    On a desktop browser I like having access to popular articles, categories and tags in a sidebar and new browsers like Edge give control to visitors in when they want to see the sidebar and can show the website like it has no sidebars anyway. A very neat feature that seems to work very well also on Genesis themes. The statistics will probably show what’s more effective in the end and I will probably try it out at some point. Would be nice to read some about the results of such a transition in the statistics.

    Kind regards, Hans

    • Robin says

      Yes, Hans, you’re right–a sidebar can definitely be helpful, depending on what you’re wanting people to do on your site. My own site tends to be a place where I’ll experiment, so I’m toying a bit with this idea of maybe having a bit of a sidebar, without it actually being a sidebar. Whether I’ll keep it for the long term, I really don’t know (probably not, as there is very little that I do keep for the long term), but it was fun to build, which is mostly why I bother here. I think it would be helpful to have fewer posts in there, so I’ll change that.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.