WPITECH
Image default
WordPress Tutorials

Enable Gutenberg Editor in Custom Post Types

In this tutorial, we will see how to enable the new Gutenberg editor in our Custom Post Types.

First we must go to the file where it belongs to our Custom Post Type, in the type path:

Domain.com -> wp-content -> plugins -> CPT> custom_post_type.php

Edit the php file, which will have a similar similarity to the following Custom Post Type of Courses:

add_action ('init', 'create_a_cpt'); 
function create_a_cpt () { 
     $ args = array ( 
     'public' => true, 
     'label' => 'Courses', 
     ' menu_icon '=>' dashicons-info ', 
     ' has_archive '=> true, 
     ' capability_type '=>' post ', 
     ' menu_position '=> 2, 
     ' show_in_rest '=> true, 
); 
register_post_type ('courses', $ args); 
}

Well, we must add the argument of:

'show_in_rest' => true,

editor_gutenberg_custom_post_types_wordpress

This will make the classic editor of all life in WordPress, is transformed into the new editor of Gutenberg, as we have in the Posts of our site.

Related posts

How to Fix WordPress RSS Feed Errors

WPITECH

10 Best WordPress Donation Plugins for 2020

WPITECH

WordPress 5.3 to Use Robots Meta Tag to Better Discourage Search Engines from Listing Sites

WPITECH