calculate values from a field and insert them into custom fields when publishing or updating post

You can achieve this using the save_post hook, this is a hook that fires once a post has been saved. Below is an example addressing what you want to achieve: function wpse253778_calculate_values( $post_id, $post ) { if ( ‘post’ !== $post->post_type ) return; $field = get_post_meta( $post_id, ‘FIELD_NAME’, true ); //get field value $new_field_value=””;//calculate new … Read more

ACF saving posts

I used the save_post_CPT() hook for doing this. I can’t remember if it sent the content the first time though: try this code: function my_project_rt_send_email( $post_id ) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; // If this is just a revision, don’t send the email. //if ( wp_is_post_revision( $post_id ) ) // … Read more

Send Notification after post published was working but stopped after the last WP update

Regarding Update 1. Perhaps you could compare the publish and modified dates and run your code only when they match, i.e. when the post is first published. Something along these lines, function to_followers_only_notify( $ID, $post ) { $posted = strtotime( $post->post_date ); $modified = strtotime( $post->post_modified ); if ( $posted !== $modified ) { return; … Read more