Skip to main content
added 10 characters in body
Source Link
Johansson
  • 15.4k
  • 11
  • 43
  • 79

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

Header structure

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file.

Update 2

It appears that you are using the free Primer theme from the WordPress's theme repository.

After digging for a while, after a chain of Tom & Jerry"Tom & Jerry styled" chase of functions declared randomly all across the templates, I've found the source of your issue. The issue is coming from line 47 of /inc/helpers.php:

$title = sprintf(
    /* translators: search term */
    esc_html__( 'Search Results for: %s', 'primer' ),
    sprintf(
        '<span>%s</span>',
        get_search_query()
    )
);

Which is what I was expecting. To solve the issue, simply remove the <span> and </span> that are wrapping the search query. You can solve this without removing the spans, but it requires a couple of more files to be chain edited. Removing it is not a big deal though.

However, you can use a child theme to do this.

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

Header structure

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file.

Update 2

It appears that you are using the free Primer theme from the WordPress's theme repository.

After digging for a while, after a chain of Tom & Jerry chase of functions declared randomly all across the templates, I've found the source of your issue. The issue is coming from line 47 of /inc/helpers.php:

$title = sprintf(
    /* translators: search term */
    esc_html__( 'Search Results for: %s', 'primer' ),
    sprintf(
        '<span>%s</span>',
        get_search_query()
    )
);

Which is what I was expecting. To solve the issue, simply remove the <span> and </span> that are wrapping the search query. You can solve this without removing the spans, but it requires a couple of more files to be chain edited. Removing it is not a big deal though.

However, you can use a child theme to do this.

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

Header structure

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file.

Update 2

It appears that you are using the free Primer theme from the WordPress's theme repository.

After digging for a while, after a chain of "Tom & Jerry styled" chase of functions declared randomly all across the templates, I've found the source of your issue. The issue is coming from line 47 of /inc/helpers.php:

$title = sprintf(
    /* translators: search term */
    esc_html__( 'Search Results for: %s', 'primer' ),
    sprintf(
        '<span>%s</span>',
        get_search_query()
    )
);

Which is what I was expecting. To solve the issue, simply remove the <span> and </span> that are wrapping the search query. You can solve this without removing the spans, but it requires a couple of more files to be chain edited. Removing it is not a big deal though.

However, you can use a child theme to do this.

added 908 characters in body
Source Link
Johansson
  • 15.4k
  • 11
  • 43
  • 79

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

[![Header structure][1]][1]Header structure

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file. [1]

Update 2

It appears that you are using the free Primer theme from the WordPress's theme repository.

After digging for a while, after a chain of Tom & Jerry chase of functions declared randomly all across the templates, I've found the source of your issue. The issue is coming from line 47 of /inc/helpers.php:

$title = sprintf(
    /* translators: search term */
    esc_html__( 'Search Results for: %s', 'primer' ),
    sprintf(
        '<span>%s</span>',
        get_search_query()
    )
);

Which is what I was expecting. To solve the issue, simply remove the https://i.sstatic.net/lQEjF.jpg<span> and </span> that are wrapping the search query. You can solve this without removing the spans, but it requires a couple of more files to be chain edited. Removing it is not a big deal though.

However, you can use a child theme to do this.

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

[![Header structure][1]][1]

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file. [1]: https://i.sstatic.net/lQEjF.jpg

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

Header structure

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file.

Update 2

It appears that you are using the free Primer theme from the WordPress's theme repository.

After digging for a while, after a chain of Tom & Jerry chase of functions declared randomly all across the templates, I've found the source of your issue. The issue is coming from line 47 of /inc/helpers.php:

$title = sprintf(
    /* translators: search term */
    esc_html__( 'Search Results for: %s', 'primer' ),
    sprintf(
        '<span>%s</span>',
        get_search_query()
    )
);

Which is what I was expecting. To solve the issue, simply remove the <span> and </span> that are wrapping the search query. You can solve this without removing the spans, but it requires a couple of more files to be chain edited. Removing it is not a big deal though.

However, you can use a child theme to do this.

added 610 characters in body
Source Link
Johansson
  • 15.4k
  • 11
  • 43
  • 79

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

[![Header structure][1]][1]

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file. [1]: https://i.sstatic.net/lQEjF.jpg

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

There is most likely a problem with escaping HTML in your code. You might be doing something like this:

echo esc_html("Search Results for: <span>search_word</span>");

Instead, use printf or only wrap your search word with esc_html():

printf('Search Results for: <span>%s</span>', esc_html( $search_word ) );

Update

The search results are rendered by search.php, most of the times (If it exists, and you don't have rewrite rules and template redirects, etc.)

But first, right click on the header that is having problem, and click Inspect Element. The developer console will open, and the header will be highlighted. Take a look at below screenshot that belongs to the header of this question:

[![Header structure][1]][1]

Now, you know the general structure that is surrounding your header. You can look for this pattern in your search.php file. [1]: https://i.sstatic.net/lQEjF.jpg

added 12 characters in body
Source Link
Johansson
  • 15.4k
  • 11
  • 43
  • 79
Loading
Source Link
Johansson
  • 15.4k
  • 11
  • 43
  • 79
Loading