Halloween Sale 15% off Ends in See the plans
PHP

Wider Content Area in the Editor

Makes the writing area of the block editor wider, giving more room on large screens without changing how the site looks to visitors.

Don’t have WPIDE yet? Install it on your site

Code

// Width of the content column in the editor.
$wpide_editor_content_width = '1000px';

add_action( 'enqueue_block_assets', function () use ( $wpide_editor_content_width ) {
    if ( ! is_admin() || ! preg_match( '/^\d+(\.\d+)?(px|rem|em|vw|%)$/', $wpide_editor_content_width ) ) {
        return;
    }

    wp_register_style( 'wpide-editor-width', false, array(), '1.0' );
    wp_enqueue_style( 'wpide-editor-width' );
    wp_add_inline_style( 'wpide-editor-width', '.editor-styles-wrapper{--wp--style--global--content-size:' . $wpide_editor_content_width . ';}.editor-styles-wrapper .is-root-container > .wp-block:not([data-align="wide"]):not([data-align="full"]){max-width:' . $wpide_editor_content_width . ';}' );
} );

Notes

Set any CSS width such as 1000px or 75rem.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.