In your code where you defined your custom post type (in a custom plugin or in your functions.php
file), you need to add this snippet for Gutenberg block editor support:
'show_in_rest' => true,
'supports' => array('editor')
Here is an example:
function portfolio_post_type() {
register_post_type( 'portfolio',
array(
'labels' => array(
'name' => __( 'Portfolio' ),
'singular_name' => __( 'Portfolio' )
),
'has_archive' => true,
'public' => true,
'rewrite' => array('slug' => 'portfolio'),
'show_in_rest' => true,
'supports' => array('editor')
)
);
}
add_action( 'init', 'portfolio_post_type' );
Related Posts:
- Enable Gutenberg on custom post type
- Creating conditional blocks for WordPress Gutenberg
- Hide “Add media”, HTML editor from TinyMCE
- Add class to Gutenberg Editor for Custom Post Types
- How to filter by custom post type on Gutenberg “Latest Posts’ block
- Gutenberg: Sidebar for specific post type
- Numbering sections and block-level elements in wpautop(); WordPress as CMS for long-form writing;
- Gutenberg how to make attribute to save to meta
- How to add button to post page WordPress 5.x
- WordPress Gutenberg-Block with ESNext (withState, withSelect)
- Remove tinyMCE from admin and replace with textarea
- The editor has encountered an unexpected error. // TypeError: Cannot read property ‘prefix’ of null
- Display different gutenberg template from selected post attributes
- Using multiple instances of wp_editor in Custom Post Type admin area
- Excluding post type from WordPress link builder
- WordPress Rest API only returns content when posttype has editor capability
- Lock post meta block at the bottom of a custom post type
- How can I list all custom post types in a block
- Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type
- Adding a Gutenberg-like custom field on a custom post type
- Classic editor showing in Gutenberg when creating a custom post type
- Creating template with h3 block (block editor)
- How To Enable Block Editor (Gutenberg) for Existing Post Type via functions.php
- How to make a custom taxonomy selectable in post publish area?
- Add TinyMCE to CPT metaboxes in 3.1?
- show_in_rest false disable Gutenberg
- I can’t choose the custom taxonomy in my custom post type on Gutenberg
- Parent field missing from custom post type in the block editor
- How to get the parent of a non-hierarchical custom post type being edited in Gutenberg
- post_type_link not working in gutenberg
- Multiple TinyMCE editors in dynamically generated textareas
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Visual editor issue by having multiple tiny mce editors in a CPT
- Getting meta in editor plugin, and event triggering issue
- Save the post parent in a custom post type in Gutenberg
- WordPress CPT save metadata in gutenberg
- Can I override a CPT template on a per post basis with Gutenberg block editor?
- Query Post Object in WP Admin
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- Show image gallery from a custom field
- How to use TinyMCE Editor for one of my custom post meta field?
- TinyMCE style formats for different post types
- P̶l̶a̶c̶e̶h̶o̶l̶d̶e̶r̶ *Default* content in Custom Post Type TinyMCE editor
- How can I set the height of the classic editor per post-type?
- Combine multiple getEntityRecords calls
- Use core block functionality in a custom block gutenberg
- gutenberg message
- How do I assign a block template (.html) to a custom post type?
- Adding custom post formatting options in custom post types
- How to save TinyMCE fields on WordPress custom post type?
- Custom post type set default template using block editor
- CPT: Enable Gutenberg, but disable editor field
- Select custom post type do display from page editor
- How add Filter by Tags and by categories to custom post type in Gutenberg block
- Is it possible to add the Gutenberg block editor to a custom taxonomy?
- How to debug failing updates for custom post type?
- Some posts not displaying by taxonomy term
- Multiple Block Quotes without using HTML
- Can you programme the selected page template to display block patterns automatically?
- Possible to limit internal link search to post types with Gutenberg editor?
- Issue displaying multiple TinyMCE editors with WPAlchemy
- Custom Gutenberg block problem – This block has encountered an error and cannot be previewed
- getEntityRecords/useEntityRecords: How to use CPT metadata?
- Custom Block: Adding “Post Type” dropdown to Sidebar Settings
- Why does have_posts() return false when in the wordpress admin, but not on the frontend?
- How to show metabox in custom php menu page
- Post term block variations not generated for custom taxonomies
- Can’t publish custom type posts that don’t support title and editor, instead they’re saved as draft
- Is there a way to get Gutenberg interface on a Custom Post Type without supporting block editor?
- How to import files to individual posts of a custom type
- How to give all CPT a folder automatically based on their slug
- How to group posts and get a mixed posts and groups view?
- Custom post type permalink tag 404
- How to Add multiple instance of meta box to custom post type
- How to make front end form only accept certain values
- How to show featured image block in custom post type for Author?
- comment_form() not showing on custom post type
- WordPress Custom Post Type is not working properly
- How to get list of taxonomy slugs ordered parents>childs?
- How can you use one database with multisite
- Custom post type permalink returns 404
- Rewrite rule for Custom Post Type Page as a parent
- Associate multiple users to custom post type
- Custom Post Type by Taxonomy
- Add custom post type drafts to RSS feed
- Multiple post types
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to define which register_post_status goes to which register_post_type?
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Using a custom post type for an RSS feed only
- Foreach inside shortcode not working as planned
- Added Custom Post Type and the View Option Doesn’t Work
- remove base slug from hierarchical custom post type
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Is it possible to have a custom post type with feed but without the archive?
- Use custom walker to add taxonomy terms to main nav menu
- Filter Posts from the Main Query
- frontend image post uploader
- Custom Post Type URL Change – (portfolio using portfolio categories) [duplicate]