Snippets: Adding/Removing Fields & Tabs In Page Settings Metabox

/**
 * Tweak the page settings metabox array
 * This example shows you how to use the "wpex_metabox_array" to take full control of the
 * page settings metabox. Sweet!
 *
 * Available "types" : text, date, number, text_html, link, textarea, code, checkbox, select,
 * color, media, editor
 *
 * @see framework/classes/metabox.php
 */
add_filter( 'wpex_metabox_array', function( $array ) {

    // Add new textfield to "media" tab which is used for blog posts by default
    $array['media']['settings']['my_new_field'] = array(
        'title'         => __( 'My Title', 'total' ), // Custom field title
        'description'   => __( 'My Description', 'total' ), // Custom field description
        'id'            => 'my_custom_field_id', // Custom field ID used to retrive via get_post_meta
        'type'          => 'text', // Type to display in the admin
    );

    // Remove the "Redirect" setting from the "Main" tab
    unset( $array['main']['settings']['post_link'] );

    // Create your own tab - cool!
    $array['my_new_tab'] = array(
        'title'     => __( 'My Tab', 'wpex' ), // Tab title
        'post_type' => array( 'post' ), // Used to limit by post type, to display on all don't add this param
        'settings'  => array(
            'my_new_field' => array(
                'title'         => __( 'My Title', 'total' ), // Custom field title
                'description'   => __( 'My Description', 'total' ), // Custom field description
                'id'            => 'my_custom_field_id', // Custom field ID used to retrive via get_post_meta
                'type'          => 'text', // Type to display in the admin
            ),
        ),
    );

    // Return fields
    return $array;

}, 40 );

Result:

All PHP snippets should be added via a child theme's functions.php file.