Last active
September 4, 2015 15:48
-
-
Save karpstrucking/83f217e9a4c7e5100695 to your computer and use it in GitHub Desktop.
Force disabling of the expanded editor option in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'gowp_disable_editor_expand_setting' ); | |
function gowp_disable_editor_expand_setting() { | |
global $_updated_user_settings; | |
$_updated_user_settings['editor_expand'] = 'off'; | |
} | |
add_action( 'admin_footer', 'gowp_disable_editor_expand_field' ); | |
function gowp_disable_editor_expand_field() { | |
$screen = get_current_screen(); | |
if ( 'post' == $screen->base ) : ?> | |
<script type="text/javascript"> | |
jQuery( document ).ready( function() { | |
jQuery( '#editor-expand-toggle' ).prop( 'disabled', true ); | |
} ); | |
</script> | |
<?php endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@shackep also, just found this in core trac, which is cleaner.