Yoast Seo breadcrumbs How to add custom text to category and tag name

0 votes
In yoast SEO breadcrumbs I would like to add a fixed text before the category name and the tag: It should look like this:

Home -> Blog -> Category: NameCategory or Home -> Blog -> Selected tag: NameTag

I'm looking for a code.
Feb 24, 2022 in Others by Kichu
• 19,050 points
1,440 views

1 answer to this question.

0 votes
add_filter('wpseo_breadcrumb_single_link', 'filter_breadcrumbs_for_h1', 10, 2);
function filter_breadcrumbs_for_h1($link_output, $link) {

    if ( is_category()  ) {
    $link_output = preg_replace("/<span\s(.+?)>(.+?)<\/span>/is", "<span $1>Category: ''$2''</span>", $link_output);
    return $link_output;
    }

    else if ( is_tag()  ) {
        $link_output = preg_replace("/<span\s(.+?)>(.+?)<\/span>/is", "<span $1>Tag: ''$2''</span>", $link_output);
        return $link_output;
        }

    else  {
        $link_output = preg_replace("/<span\s(.+?)>(.+?)<\/span>/is", "<span $1>$2</span>", $link_output);
        return $link_output;
        }

}
answered Feb 25, 2022 by narikkadan
• 63,680 points

Related Questions In Others

0 votes
1 answer

How to add meta keyword in wordpress using yoast seo plugin.?

if you dont want to use code ...READ MORE

answered Feb 12, 2022 in Others by narikkadan
• 63,680 points
983 views
0 votes
1 answer

How to Remove canonical tag added by Yoast SEO plugin

first  Log in to your WordPress website ...READ MORE

answered Feb 28, 2022 in Others by narikkadan
• 63,680 points
1,090 views
0 votes
1 answer
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,680 points
2,164 views
0 votes
1 answer

Problem with yoast SEO

This is (probably) not a problem of ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,680 points
439 views
0 votes
1 answer

how to show the <meta> values of yoast seo with some function?

check this folder : wordpress-seo\src\presenters\open-graph you can ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,680 points
583 views
0 votes
1 answer

How to echo WP SEO Yoast synonyms in PHP?

 the meta_key in wp_postmeta table is _yoast_wpseo_keyword ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,680 points
1,114 views
0 votes
1 answer

Yoast SEO remove og description and twitter description on certain page

try this out it wil help ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,680 points
554 views
0 votes
1 answer

Yoast Seo breadcrumbs: How to add custom text to category and tag name

use this code  add_filter('wpseo_breadcrumb_single_link', 'filter_breadcrumbs_for_h1', 10, 2); function filter_breadcrumbs_for_h1($link_output, ...READ MORE

answered Feb 12, 2022 in Others by narikkadan
• 63,680 points
681 views
0 votes
1 answer

How to add a class to the <a> tag in Yoast SEO breadcrumbs?

add_filter( 'wpseo_breadcrumb_single_link', 'ss_breadcrumb_single_link', 10, 2 ); function ss_breadcrumb_single_link( ...READ MORE

answered Feb 22, 2022 in Others by narikkadan
• 63,680 points
1,540 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP