Support » Plugin: Yoast SEO » Get the custom description in page

  • WordPress version:3.5.1
    WordPress SEO version:1.4.7

    I did this:
    Added in functions.php the following function:
    function set_desc(){
    if(is_page()) {
    //Method 1
    $object = new WPSEO_Frontend();
    $metadesc = $object->metadesc(false);
    //Method 2
    //$metadesc = wpseo_get_value(‘metadesc’);
    return $metadesc;
    } else {
    return ‘Default description’;
    }
    }
    add_filter(‘wpseo_metadesc’, ‘set_desc’);

    I expected the plugin to do this:
    I expected the plugin to get the custom description I wrote in the Meta Description field inside every page.
    Instead it did this: break the site. I’ve tried with both methods, none worked.

    http://wordpress.org/extend/plugins/wordpress-seo/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get the custom description in page’ is closed to new replies.