Answer the question
In order to leave comments, you need to log in
How to execute code when adding a new Wordpress post?
Hello!
How to execute the code when creating a new post?
Now mine looks like this:
add_action( 'save_post_news', 'wpdocs_notify_subscribers', 10, 3);
function wpdocs_notify_subscribers( $post_id, $post, $update ) {
if ( $update ) {
return;
}
// Здесь выполняю код
}
Answer the question
In order to leave comments, you need to log in
Try instead of save_post_news to put save_post_post or just save_post and check how it will work in this case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question