WordPress get tags in “publish_post” hook

if you want to get all selected tag in “publish_post” try below code. it will give you selected tag from post. remove wp_die(“all Tags”); after verify that you can get proper tags on publish post. add_action( ‘publish_post’, ‘post_published_notification’, 10, 2 ); function post_published_notification( $ID, $post ) { $all_tags = $_POST[‘tax_input’][‘post_tag’]; if ( $all_tags ) { … Read more

My posts are getting to Auto draft when I try to Publish

Can you try the following in your wp-config.php define( ‘AUTOSAVE_INTERVAL’, 3600 ); // autosave 1x per hour define( ‘WP_POST_REVISIONS’, false ); // no revisions What this would do disable auto-save and post-revisions. Try with that, if it works could be your then it could be your internet or hosting conflicts.

Send email to user when I publish a new post

Updated code for statuses as per @Fredrik’s answer as his is more accurate. To trigger this when publishing, you could change your first if to if ( $new_status === ‘inherit’ && $old_status === ‘new’ ) That way, your code should trigger only when you publish a post. EDIT: Some notes on your code. if ( … Read more

Hook when post is set from published to draft?

Yes, these are probably the right calls to use for what you want. I just checked this by adding this to my functions.php: add_action(‘publish_to_draft’, ‘doStuff’); function doStuff() { update_option(‘foo’, ‘bar1’); } Then using the quick edit in the posts list to change a published post to draft, and this hook definitely ran at that point … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)