Custom Fields
Re-Envisioned
Support MB Settings Page Disabling submit button in option page Reply To: Disabling submit button in option page

#10923

Anh Tran
Keymaster

Hi Bezzo,

You can easily hide the submit button with CSS.

This code below lets you enqueue a CSS file for the settings page:

add_action( 'admin_enqueue_scripts', function() {
    $screen = get_current_screen();
    if ( 'your-screen-id' == $screen->id ) {
        wp_enqueue_style( 'your-file', 'http://url-to-your.css' );
    }
} );

To get the screen ID of the settings page, you can use the Inspector plugin. The screen ID is shown in the “Help” tab, like this:

View post on imgur.com

In your CSS file, you can simply enter this:

.wrap .submit { display: none; }

If the process above is complicated, you can use a “quick and dirty” tip below:

When you register a meta box for the settings page, add a custom_html field like this:

$meta_boxes[] = [
    // Other fields
    [
        'type' => 'custom_html',
        'std' => '<style>.wrap .submit { display: none; }</style>',
    ]
];

It will output the <style> to the page and hide the submit button.