Skip to content

Instantly share code, notes, and snippets.

@shanept
Last active December 4, 2021 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanept/d3bd889c2758ce568fe11e331d38927d to your computer and use it in GitHub Desktop.
Save shanept/d3bd889c2758ce568fe11e331d38927d to your computer and use it in GitHub Desktop.
<?php
// Get the following into a theme or plugin, and WordPress will behave as if DISALLOW_FILE_EDITS is set to false instead of true.
// Hooks WP capability system to override the do_not_allow signal.
function __wpide_override_fsmethod( $caps, $cap, $user_id, $args ) {
if ( in_array( $cap, array( 'edit_themes', 'edit_files', 'edit_plugins' ) ) ) {
array_pop( $caps );
$caps[] = $cap;
}
return $caps;
}
add_filter( 'map_meta_cap', '__wpide_override_fsmethod', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment