How to make work shortcodes in SEOPress Breadcrumbs using Filter

We can use seopress breadcrumbs filter to change the output of breadcrumbs.

SEOPress Breadcrumbs Filter

You can use below code to functions.php or any plugin to make it work.

add_filter('seopress_pro_breadcrumbs_crumbs', 'cww_breadcrumbs_crumbs');

function cww_breadcrumbs_crumbs($crumbs) {
    //$crumbs is a multidimensional array.
    //First array: key=position, second array: 0=>page title, 1=>URL
    //do your stuff
    foreach ($crumbs as $key => $crumb) {
        // apply do_shortcode to breadcrumb title
        $crumbs[$key][0] = do_shortcode($crumbs[$key][0]);
    }
    return $crumbs;
}

Leave a Comment

Your email address will not be published.