Check if new post or update before save_post action
You can achieve this by using the wp_insert_post hook, which is called before the post is saved or updated. Inside this hook, you can check if the post ID exists to determine if it’s an update or a new post. Here’s how you can do it: add_action(‘wp_insert_post’, function ($post_ID, $post, $update) { if (!$update) { … Read more