WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WordPress SEO by Yoast] SEO Description not working

[Plugin: WordPress SEO by Yoast] SEO Description not working

Viewing 2 replies - 1 through 2 (of 2 total)
  • @k0k1man, any luck with this?

    I don’t use wp_head() in my theme so I’m looking for a template function to display the Yoast page description / keywords within my header.php file.

    Anyone?

    EDIT: Found that the yoast plugin simply stores the values in postmeta, so this solution is working perfect for my use. I’ve placed the following within my <head></head> tags.

    <?php
    	//Grab the page seo settings
    	$metadesc = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true);
    	$metakeywords = get_post_meta($post->ID, '_yoast_wpseo_metakeywords', true);
    ?>
    
    <?php if(!empty($metadesc)) : ?><meta name="description" content="<?php echo $metadesc ?>" /><?php endif ?>
    
    <?php if(!empty($metakeywords)) : ?><meta name="keywords" content="<?php echo $metakeywords ?>" /><?php endif ?>

    Hope that helps someone else.

    The plugin is pulling whatever is the first tag in the post for the description. I have a page with a gallery, so the first tag happens to be a <style> tag so that’s what I’m seeing as the meta description and the opengraph description.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] SEO Description not working’ is closed to new replies.