API for auto-generated description
-
I’ve searched for a couple hours, and tried several coding ideas in PHP. I’m stuck. I need the default description created by yoast for the schema code I’m adding. I’ve ended up writing a complicated function to create a proper excerpt but I can’t match the one I get yoast creating.
I would like to get a copy of the default yoast auto-generated meta-description. I’m not referring to the excerpts I wrote and entered into yoast. Those I can get in my PHP code (see below). I’m asking about the default excerpt yoast creates when there isn’t one manually added to the yoast panel with the post editor.
This call returns null when there is no manually entered desc. It works only if there was one written manually.
get_post_meta($post->ID, '_yoast_wpseo_metadesc', true)
These WordPress functions also do not produce the default yoast excerpt:
get_the_excerpt()
andthe_excerpt()
Yet there *is* a nicely filtered description created and outputted as meta name=”description” and og:description.
My question, how to I get that same default except for use in my PHP template?
- The topic ‘API for auto-generated description’ is closed to new replies.