vendredi 13 mai 2016

Get Yoast Plugin infos on publish_post Wordpress

I'm trying to get yoast plugin infos on publish_post, I know that get_post_meta is fired after publish_post but don't see how could I grab the posted values on publish_post...I thought by getting $_POST values it could work, but seems not. My code so far is:

add_action( 'publish_post', 'post_published_notification');
function post_published_notification( $ID, $post ) {
            $url = $post->post_name;
            $yoast_seo_title = get_post_meta($ID, '_yoast_wpseo_title', true);
            $yoast_meta_desc = get_post_meta($ID, '_yoast_wpseo_metadesc', true);
}

Thanks in advance for your help.

EDIT: Can't hook on save_post or it would be fired twice...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire