• Resolved José López-Púa

    (@tarifatrip)


    Hi,

    I’ve purchased the PRO version of CM Pop-Up banners and I’m trying to get its custom post types available via the WordPress JSON API without any luck.

    In __construct() function I register the corresponding actions to add REST support to the CPTs:

    add_action( 'init', 'cm_ad_item_rest_support', 30 );
     function cm_ad_item_rest_support() {
         global $wp_post_types;
         //be sure to set this to the name of your post type!
         $post_type_name = CMPopUpBannersShared::POST_TYPE;
         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 = 'campaign';
             $wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller';
        }
    }

    After doing some debugging what I discovered is that $wp_post_types does not contain cm-ad-item and cm-ai-template.

    I have registered several CPTs from other 3rd party plugins already but I can’t manage to do with CM Pop-Up banners.

    Any idea of what I’m missing?

    Thanks!

    • This topic was modified 7 years, 10 months ago by .
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Show CM Pop-Up Pro cpts in JSON-API’ is closed to new replies.