How to get Yoast post meta during save_post

In my plugin, I’m trying to retrieve Yoast’s post meta when the post is saved for the first time or updated.

get_post_meta doesn’t work, as I have read in some other articles that post meta is saved after the post.

My question is how do I get the post meta during save_post action?

I tried the following, but no luck:

$fb_meta_title = get_post_meta($ID, '_yoast_wpseo_opengraph-title', true);

and

if ($fb_meta_title==''){ $fb_meta_title = $_POST['yoast_wpseo_opengraph-title']; }

Read more here: How to get Yoast post meta during save_post

Leave a Reply

Your email address will not be published. Required fields are marked *