• Hi o/
    I want to stop the user from save a post and show him an error message saying that something is wrong. There’s a hook for this?

    function my_custom_metabox(){
            echo '<input name="occupation" ....';
        }
        function save_metabox_field(){
            global $post;
            if(isset($_POST['occupation'])){
                 update_post_meta($post->ID, 'occupation', $_POST['occupation']);
            }
        }

    How do I check if $_POST[‘occupation’] is not empty (just for example)?
    OBS: I hide the add_actions for simplify the code

  • The topic ‘How do I validate my fields from metaboxes’ is closed to new replies.