Using php to overwrite or replace title tag, while using yoast [closed]

The WPSEO plugin by Yoast has a filter for the title: ‘wpseo_title’. You’ll need to add something like this:

add_filter('wpseo_title', 'filter_product_wpseo_title');
function filter_product_wpseo_title($title) {
    if(  is_singular( 'product') ) {
        $title = //your code
    }
    return $title;
}

More info at the WordPress SEO API Docs page.

Leave a Comment