Skip to content

Instantly share code, notes, and snippets.

@grappler
Created May 9, 2018 08:47
Show Gist options
  • Save grappler/e47aaa03bc698c257752e240f3362ecc to your computer and use it in GitHub Desktop.
Save grappler/e47aaa03bc698c257752e240f3362ecc to your computer and use it in GitHub Desktop.
Remove all traces of the classic editor in Gutenberg
<?php
/**
* Removes the classic editor actions links.
*/
add_action( 'admin_init', function() {
// For hierarchical post types.
add_filter( 'page_row_actions', 'gutenberg_remove_classic_editor_links', 10, 2 );
// For non-hierarchical post types.
add_filter( 'post_row_actions', 'gutenberg_remove_classic_editor_links', 10, 2 );
} );
/**
* Removes additional link in the post/page screens to edit any post/page in
* the Classic editor.
*
* @param array $actions Post actions.
* @param WP_Post $post Edited post.
*
* @return array Updated post actions.
*/
function gutenberg_remove_classic_editor_links( $actions, $post ) {
unset( $actions['classic'] );
return $actions;
}
/**
* Hide Classic Editor dropdown from create post.
*/
add_action( 'admin_print_scripts-edit.php', function() {
?><style type="text/css">.split-page-title-action .expander{display:none;}</style><?php
}, 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment