WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] [Plugin: WordPress SEO] Getting title/description for other purpose (6 posts)

  1. tsahil
    Member
    Posted 3 years ago #

    Hi,

    It would be great if I could get through php functions of this plugin the description or title that I provided to it.
    I would like to use it as a short intro/excerpt to the posts somewhere else on my blog.
    Is that possible at all?

    Thanks,
    Tsahi

  2. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Yeah it is, check in frontend/class-frontend.php :)

  3. tsahil
    Member
    Posted 3 years ago #

    What I found was wpseo_metadesc() which looked promising, but when I try to build my homepage out of a few posts that show it as the excerpt, it gives nothing back.
    The internal if/else statements there just fall down through all of them, leaving the value empty.

  4. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    it's stored in a post meta value, _wpseo_metadesc I think, you could just grab that?

  5. tsahil
    Member
    Posted 3 years ago #

    Closest thing I found was _yoast_wpseo_metadesc, but I have no clue how to access it in php (I am an engineer, but not that good with php).

  6. tsahil
    Member
    Posted 3 years ago #

    Ok, in the end of the day, this is what worked for me:

    echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic