• There is an error in the wilson_cd_meta_box_save function in the functions.php file with the capabilities check. It throws and undefined index: 0 error on post save. You need to pass in the $post_id in the capabilities check. Please consider patching in future releases.

    function wilson_cd_meta_box_save( $post_id ) {
    	// Bail if we're doing an auto save
    	if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
    
    	// if our nonce isn't there, or we can't verify it, bail
    	if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
    
    	// if our current user can't edit this post, bail
    	if( !current_user_can( 'edit_post', $post_id ) ) return; //must pass $post_id here
    
    	// now we can actually save the data
    	$allowed = array(
    		'a' => array( // on allow a tags
    			'href' => array() // and those anchords can only have href attribute
    		)
    	);
    
    	// Probably a good idea to make sure the data is set
    	if( isset( $_POST['videourl'] ) )
    		update_post_meta( $post_id, 'videourl', wp_kses( $_POST['videourl'], $allowed ) );		
    
    }
  • The topic ‘Capabilities Error with cd_meta_box_save’ is closed to new replies.