'wpmark_slide_info', // meta box id 'Slide Information', // meta box title 'wpmark_metabox_html', // function for html output 'wpmark_slide', // post type to add it to 'normal', // context - part of page to add it to 'default' // priority ); ! } ! add_action( 'add_meta_boxes', ‘wpmark_add_meta_box' );
the correct post type */ if ( 'wpmark_slide' != get_post_type( $post_id ) return; ! /* check if the current user is authorised to do this action */ if( ! current_user_can( 'edit_page', $post_id ) ) return; ! /* secondly we need to check if the user intended to change this value */ if ( ! isset( $_POST[ 'wpmark_nonce_name' ] ) || ! wp_verify_nonce( $_POST[ 'wpmark_nonce_name' ], plugin_basename( __FILE__ ) ) ) return; ! /* santize the user input */ $wpmark_data = sanitize_text_field( $_POST[ 'wpmark_slide_link'] ); ! /* save the post data */ update_post_meta( $post_id, '_wpmark_slide_link', $wpmark_data ); ! } add_action( 'save_post', 'wpmark_save_metabox_data' );