tags come up when i update a post. When I publish a new post for the first time, I cannot get the tags. How do I get the tags when I publish for the first time?
add_action('save_post', 'bunu_worker', 10, 2);
function bunu_worker($ID, $posts) {
global $wp,$post;
$postge = get_the_tags($ID);
$arkadaslar = 'my@mymail.com';
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $arkadaslar, "subject mesage", print_r($postge, true), $headers , array() );
return;
}
add_action ('save_post', 'job_worker', 10, 2);
I could not get the tags because the DB record is late in the process.
The hook below works after DB records occur so I can get the tags.
add_action ('set_object_terms', 'job_worker', 10, 2);