Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Questions (http://www.datafeedr.com/forums/forumdisplay.php?f=67)
-   -   WP Yoast SEO - how to remove description? (http://www.datafeedr.com/forums/showthread.php?t=10094)

redspan January 14th, 2014 02:16 PM

WP Yoast SEO - how to remove description?
 
Store ID:
Website URL: http://www.myvintageclothing.co.uk
URL to page in question: http://www.myvintageclothing.co.uk/s...swing-dresses/


Hi,

On any category or product page, if I view the source code I can see the correct title, but the first meta description tag is the same description as the store homepage.

Then, further down the source code, is the correct meta description and meta keywords (some are missing because I haven't written them yet, but the code is there). My concern is that Google will see the Yoast duplicate description first and ignore the true description further down.

How do I ensure that the Yoast meta description for the homepage is removed from all other pages?

Thanks

Eric January 14th, 2014 02:51 PM

Hi,

Here's the code you need to remove / disable / override the Yoast WordPress SEO generated <title> tags, canonical links, meta description and meta keywords on all Datafeedr store pages.

This should be placed in your theme's functions.php file.

Hope this helps:

PHP Code:

/**
 * This removes the Yoast Wordpress SEO plugin generated title on all Datafeedr store pages.
 */
add_action'init''dfr_remove_wpseo_title' );  
function 
dfr_remove_wpseo_title$title ) { 
    global 
$wpseo_front
    if (
is_dfr()) { 
        
remove_filter('wp_title', array($wpseo_front'title'), 15); 
    } 
}

/**
 * This removes the Yoast Wordpress SEO plugin generated canonical links on all Datafeedr store pages.
 */
add_filter'wpseo_canonical''dfr_remove_wpseo_canonical' );  
function 
dfr_remove_wpseo_canonical$canonical ) { 
    if (
is_dfr()) { 
        
$canonical false
    } 
    return 
$canonical
}

/**
 * This removes the Yoast Wordpress SEO plugin generated meta description on all Datafeedr store pages.
 */
add_filter'wpseo_metadesc''dfr_remove_wpseo_metadesc' );
function 
dfr_remove_wpseo_metadesc$description ) { 
    if (
is_dfr()) {
        
$head $GLOBALS['DFR_PLUGIN']->shop_content->head;
        
preg_match('~<meta name="description" content="(.*?)"~'$head$output);
        
$description $output[1]; 
    } 
    return 
$description
}

/**
 * This removes the Yoast Wordpress SEO plugin generated meta keywords on all Datafeedr store pages.
 */
add_filter'wpseo_metakey''dfr_remove_wpseo_metakey' );
function 
dfr_remove_wpseo_metakey$keywords ) { 
    if (
is_dfr()) { 
        
$head $GLOBALS['DFR_PLUGIN']->shop_content->head;
        
preg_match('~<meta name="keywords" content="(.*?)"~'$head$output);
        
$description $output[1]; 
    } 
    return 
$keywords
}

/**
 * This gets the right title for product pages
 */
add_filter'wpseo_title''dfr_update_title' );  
function 
dfr_update_title$title ) { 
    if (
is_dfr()) {
        return 
$GLOBALS['DFR_PLUGIN']->shop_content->title ' ' get_bloginfo'name' );
    } 
    return 
$title;
}

/**
 * Gets the right OG title
 */
add_filter'wpseo_opengraph_title''dfr_opengraph_title' );
function 
dfr_opengraph_title$title ) {
    if (
is_dfr()) { 
        
$title $GLOBALS['DFR_PLUGIN']->shop_content->title;
    }
    return 
$title;


/**
 * Gets the right facebook image for product pages.
*/
add_filter'wpseo_opengraph_image''dfr_remove_og_image' );
function 
dfr_remove_og_image$image ) {
    if( !
is_dfr() ) {
        return 
$image;
    } else {
        if ( 
is_dfr('product') ) {
            
$head $GLOBALS['DFR_PLUGIN']->shop_content->head;
            
preg_match('~<meta property="og:image" content="(.*?)"~'$head$output);
                    
$image $output[1]; 
            return 
$image;
        }
    }


More Yoast WordPress SEO hooks (filters and actions) can be found here:
http://yoast.com/wordpress/seo/api/

Eric

redspan January 14th, 2014 03:11 PM

Great! Thanks Eric :)


All times are GMT -5. The time now is 02:30 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.