Hide Block Editor
- This topic has 6 replies, 3 voices, and was last updated 1 year, 5 months ago by
[email protected].
-
AuthorPosts
-
March 20, 2022 at 8:41 PM #34682
[email protected]
ParticipantHey folks,
New to metabox and scratching my head on how to hide the default block editor when using a custom fields. In ACF you have an option to hide/remove the block editor, comments, discussion, post type, etc -- but for the life of me I cannot find anything on this with metabox.
Any thoughts? Cheers
March 21, 2022 at 12:31 PM #34697Long Nguyen
ModeratorHi,
For the custom post type, you can go to tab Supports when creating/editing the post type to disable block editor, comments ...
Refer to this documentation https://docs.metabox.io/creating-post-types/#supports-settings
March 21, 2022 at 5:34 PM #35178[email protected]
ParticipantHey Long,
Thank you for your reply and yes, I know I can do that with the custom post type. But what if I do not use a post type and just creating a custom fields for say a view template?
What I am ding is using metabox as a page builder -- so I would create a custom field group and them show it on a specific page. What I don't want showing up is the extra content editor, as I will have specific areas where the page content will be.
Are you able to do that? Or does it require a custom post type?
Cheers
March 22, 2022 at 12:49 PM #35191Long Nguyen
ModeratorHi,
For the default
postandpageof WordPress, Meta Box does not have an option to remove the default content box. But you can try to use this code to remove it.// Remove the editor. Change 'post' to your custom post type. add_action( 'init', function () { remove_post_type_support( 'post', 'editor' ); } );Refer to this tutorial https://docs.metabox.io/save-wysiwyg-content-post-content/
March 22, 2022 at 6:13 PM #35201[email protected]
ParticipantPerfect, thank you Long, that will do the trick. =)
Cheers
May 17, 2024 at 7:22 PM #45453Bertus de Leeuw
ParticipantThis is not working with classic editor...
May 17, 2024 at 7:33 PM #45454[email protected]
ParticipantStill works fine for me. Make sure you change 'post' to 'page' if you are wanting it to work on your pages.
If you need it for both posts and pages, then use this.
// Remove the editor. Change 'post' to your custom post type. add_action( 'init', function () { remove_post_type_support( 'post', 'editor' ); remove_post_type_support( 'page', 'editor' ); } ); -
AuthorPosts
- You must be logged in to reply to this topic.