save_post hook partly firing in update post

Question

I’ve a function attach to the save post custom post type hook and when I add a custom post type everything is fine.
But when I edit it and update it only a part of my function works

add_action('save_post_$custom' , 'example')

function example() {

$errors = validation_function();

  if ($erros) {
    return $post_id;
  } else {
    update meta logic
  }
}

On add post the $errors verification and update meta method works, but on edit post the errors verification doesn’t work but the update meta logic does work.

So it’s not the problem of hook not firing I’ve no clues.

Any ideas ?

0
DRK 1 month 0 Answers 5 views 0

Leave an answer