Extensions/WordPress/MetaBox/MetaBox.php
public function save( $post_id ) 
    {
        /**
         * A note on security:
         * 
         * We need to verify this came from the our screen and with proper authorization,
         * because save_post can be triggered at other times. since metaboxes can 
         * be removed - by having a nonce field in only one metabox there is no 
         * guarantee the nonce will be there. By placing a nonce field in each 
         * metabox you can check if data from that metabox has been sent 
         * (and is actually from where you think it is) prior to processing any data.
         * @see http://wordpress.stackexchange.com/a/49460/25959
         */
        
        // Check if our nonce is set.
        if ( ! isset( $_POST[$this->nonce_name()] ) )
        {
            return $post_id;
        }

        // Verify that the nonce is valid.
        $nonce = filter_input( INPUT_POST, $this->nonce_name() );
        if ( ! wp_verify_nonce( $nonce, $this->action_name() ) )
        {
            return $post_id;
        }
        
        // Bail if this is an autosave (nothing has been submitted)
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
        {
            return $post_id;
        }
        
        // Check the user's permissions.
        $post_type = filter_input( INPUT_POST, 'post_type' );
        if( in_array( $post_type, $this->settings['post_types'] ) )
        {
            // NOTE: this might not work for custom post types, unless Amarkal
            // is used to register them (custom post types might have labels different 
            // than 'edit_{post_type}'
            $capability = 'edit_'.$post_type;
            if ( !current_user_can( $capability, $post_id ) )
            {
                return $post_id;
            }
        }
        else
        {
            return $post_id;
        }

        // OK, it is safe to process data.
        $old_instance = \get_post_meta( $post_id, $this->settings['id'], true );
        $new_instance = $this->form->updater->update( $old_instance === "" ? array() : $old_instance );
        \update_post_meta( $post_id, $this->settings['id'], $new_instance );
        
        // Callback
        $callable = $this->settings['callback'];
        if(is_callable( $callable ) )
        {
            $callable( $post_id, $new_instance );
        }
    }
public function save( $post_id ) 
    {
        /**
         * A note on security:
         * 
         * We need to verify this came from the our screen and with proper authorization,
         * because save_post can be triggered at other times. since metaboxes can 
         * be removed - by having a nonce field in only one metabox there is no 
         * guarantee the nonce will be there. By placing a nonce field in each 
         * metabox you can check if data from that metabox has been sent 
         * (and is actually from where you think it is) prior to processing any data.
         * @see http://wordpress.stackexchange.com/a/49460/25959
         */
        
        // Check if our nonce is set.
        if ( ! isset( $_POST[$this->nonce_name()] ) )
        {
            return $post_id;
        }

        // Verify that the nonce is valid.
        $nonce = filter_input( INPUT_POST, $this->nonce_name() );
        if ( ! wp_verify_nonce( $nonce, $this->action_name() ) )
        {
            return $post_id;
        }
        
        // Bail if this is an autosave (nothing has been submitted)
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
        {
            return $post_id;
        }
        
        // Check the user's permissions.
        $post_type = filter_input( INPUT_POST, 'post_type' );
        if( in_array( $post_type, $this->settings['post_types'] ) )
        {
            // NOTE: this might not work for custom post types, unless Amarkal
            // is used to register them (custom post types might have labels different 
            // than 'edit_{post_type}'
            $capability = 'edit_'.$post_type;
            if ( !current_user_can( $capability, $post_id ) )
            {
                return $post_id;
            }
        }
        else
        {
            return $post_id;
        }

        // OK, it is safe to process data.
        $old_instance = \get_post_meta( $post_id, $this->settings['id'], true );
        $new_instance = $this->form->updater->update( $old_instance === "" ? array() : $old_instance );
        \update_post_meta( $post_id, $this->settings['id'], $new_instance );
        
        // Callback
        $callable = $this->settings['callback'];
        if(is_callable( $callable ) )
        {
            $callable( $post_id, $new_instance );
        }
    }
public function save ( $ post_id ) { /**
         * A note on security:
         * 
         * We need to verify this came from the our screen and with proper authorization,
         * because save_post can be triggered at other times. since metaboxes can 
         * be removed - by having a nonce field in only one metabox there is no 
         * guarantee the nonce will be there. By placing a nonce field in each 
         * metabox you can check if data from that metabox has been sent 
         * (and is actually from where you think it is) prior to processing any data.
         * @see http://wordpress.stackexchange.com/a/49460/25959
         */ // Check if our nonce is set. if ( ! isset ( $ _POST [ $ this -> nonce_name ( ) ] ) ) { return $ post_id ; } // Verify that the nonce is valid. $ nonce = filter_input ( INPUT_POST , $ this -> nonce_name ( ) ) ; if ( ! wp_verify_nonce ( $ nonce , $ this -> action_name ( ) ) ) { return $ post_id ; } // Bail if this is an autosave (nothing has been submitted) if ( defined ( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return $ post_id ; } // Check the user's permissions. $ post_type = filter_input ( INPUT_POST , 'post_type' ) ; if ( in_array ( $ post_type , $ this -> settings [ 'post_types' ] ) ) { // NOTE: this might not work for custom post types, unless Amarkal // is used to register them (custom post types might have labels different  // than 'edit_{post_type}' $ capability = 'edit_' . $ post_type ; if ( ! current_user_can ( $ capability , $ post_id ) ) { return $ post_id ; } } else { return $ post_id ; } // OK, it is safe to process data. $ old_instance = \ get_post_meta ( $ post_id , $ this -> settings [ 'id' ] , true ) ; $ new_instance = $ this -> form -> updater -> update ( $ old_instance === "" ? array ( ) : $ old_instance ) ; \ update_post_meta ( $ post_id , $ this -> settings [ 'id' ] , $ new_instance ) ; // Callback $ callable = $ this -> settings [ 'callback' ] ; if ( is_callable ( $ callable ) ) { $ callable ( $ post_id , $ new_instance ) ; } }
Save the meta when the post is saved.

@param int $post_id The ID of the post being saved.
Save the meta when the post is saved .