Wordpress SEO - What are you looking for?

If you're looking for answers to SEO or wordpress related questions, type in a phrase and wait for hints or click enter! The results also show links to external sources.

161 articles in the database

How to automatically redirect search results when they contain only one result?

[ Article content is protected by Plagiashield ]

It often happens that from the entire resources on our site a user searching pagesę za pomocą wbudowanej search engines WordPress-a receives only one search result. Only from the list does it go directly to the entry. A co if we were able to redirect him automatically to the article he was interested in?

To do this, you need to include the following in your template websites put the following code in the functions.php file:

add_action('template_redirect', 'redirect_single_post');
function redirect_single_post() {
if (is_search()) {
global $wp_query;
if ($wp_query->post_count == 1 && $wp_query->max_num_pages == 1) {
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );


Wojciech Wladzinski

O Wojciech Wladzinski

I have been working in SEO industry since 2008. On a daily basis a senior SEO specialist in a company Seogroup. I create and optimize large websites like and smaller websites. I am particularly fond of the environment WordPresswhich, despite popular belief, is not just a blogging platform.
  • Internal Links and Sematics

  • Link building
  • Sematics
  • Link building has never been easier. Hundreds of link possibilities in one click.
  • See

[ Article content is protected by Plagiashield ]

SEMRush - the best tool for SEO and PPC.

Read previous post:
Shortcode in widgets

Many of you probably use shortcode in your posts or pages on wordpress. It often happens that a user puts...