Support » Plugin: Yoast SEO » [Plugin: WordPress SEO] Getting title/description for other purpose

  • Resolved tsahil

    (@tsahil)


    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Joost de Valk

    (@joostdevalk)

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

    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.

    Plugin Author Joost de Valk

    (@joostdevalk)

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

    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).

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

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress SEO] Getting title/description for other purpose’ is closed to new replies.