Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Example of disabling Gutenberg by template
- * @see https://www.billerickson.net/disabling-gutenberg-certain-templates/
- */
- add_filter( 'gutenberg_can_edit_post_type', 'disable_gutenberg_editor_by_template', 10, 2 );
- function disable_gutenberg_editor_by_template( $can_edit, $post_type ) {
- if( !is_admin() || !isset( $_GET['post'] ) || !intval( $_GET['post'] ) ) return $can_edit;
- $exclude_templates = get_option( 'my_array_of_post_types_to_disable' );
- if( !$exclude_templates ) return $can_edit;
- $current_template = get_page_template_slug( $_GET['post'] );
- return !in_array( $current_template, $exclude_templates );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement