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

Use value from ACF to populate other fields

Untested, but if I understand you correctly, try something like this: $results = new WP_Query( array ( ‘post_id’ => ‘<id-here>’, ‘post_type’ => ‘acf-field’, //not necessary, but insurance ‘post_excerpt’ => ‘<custom-field-name>’, //not necessary, but insurance ‘meta_query’ => array ( ‘key’ => ‘<custom-field-name>’, ) ) );

WordPress doesn’t save or publish new posts

Finally found a solution to my problem. In my case I had set a 301 redirect for my front page (that is for “domain.com”) to another page I wanted to use as the front page. Apparently that caused a problem when Elementor tried accessing it’s content (although I’m not sure why it needs the content … Read more