• I’m trying to add event CPT to REST API, this way: Adding REST API Support To Existing Content Types with no luck.

    When I try this code:

    /**
     * Add REST API support to an already registered post type.
     */
    add_action( 'init', 'my_custom_post_type_rest_support', 25 );
    function my_custom_post_type_rest_support() {
      global $wp_post_types;
    
      //be sure to set this to the name of your post type!
      $post_type_name = 'event';
      if( isset( $wp_post_types[ $post_type_name ] ) ) {
        $wp_post_types[$post_type_name]->show_in_rest = true;
        // Optionally customize the rest_base or controller class
        $wp_post_types[$post_type_name]->rest_base = $post_type_name;
        $wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller';
      }
    }

    I get some errors:

    https://www.dropbox.com/s/iuchg5k02p3i7qm/Captura%20de%20pantalla%202018-02-15%2019.20.37.png?dl=0

    Is it possible to add Gutemberg editor to event CPT?

    Thank you in advance.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Gutenberg plugin in event CPT’ is closed to new replies.