ID, 'bi_functionality_paid_content', true );
// Set default values.
if( empty( $bi_functionality_paid_content ) ) $bi_functionality_paid_content = array();
// Form fields.
echo '
';
}
public function save_metabox( $post_id, $post ) {
// Add nonce for security and authentication.
$nonce_name = isset( $_POST['bi_functionalitynonce'] ) ? $_POST['bi_functionalitynonce'] : '';
$nonce_action = 'bi_functionalitynonce_action';
// Check if a nonce is set.
if ( ! isset( $nonce_name ) )
return;
// Check if a nonce is valid.
if ( ! wp_verify_nonce( $nonce_name, $nonce_action ) )
return;
// Check if it's not an autosave.
if ( wp_is_post_autosave( $post_id ) )
return;
// Check if it's not a revision.
if ( wp_is_post_revision( $post_id ) )
return;
// Sanitize user input.
$bi_functionalitynew__paid_content = isset( $_POST[ 'bi_functionality_paid_content' ] ) ? array_intersect( (array) $_POST[ 'bi_functionality_paid_content' ], array( '' ) ) : array();
// Update the meta field in the database.
update_post_meta( $post_id, 'bi_functionality_paid_content', $bi_functionalitynew__paid_content );
}
}
new Bi_Functionality_Paid_Content_Field;