Hello @anandaravind,
What is the slug name of your third CPT?
Hi @creativethemeshq, Here is the slug list of CPTs: books / news / courses. All three are non-hierarchical. books and news comes up, while courses does not come up.
Except for name, all post types have the same configuration:
name: courses
label: courses
singular_label: course
description: ""
public: true
publicly_queryable: true
show_ui: true
show_in_nav_menus: true
delete_with_user: false
show_in_rest: true
rest_base: ""
rest_controller_class: ""
has_archive: true
has_archive_string: ""
exclude_from_search: false
capability_type: post
hierarchical: false
rewrite: true
rewrite_slug: ""
rewrite_withfront: true
query_var: true
query_var_slug: ""
menu_position: ""
show_in_menu: true
show_in_menu_string: ""
menu_icon: ""
custom_supports: ""
-
This reply was modified 4 years, 10 months ago by
anandaravind.
Hello @anandaravind,
Thanks for providing this info.
The thing is that some CPT’s slugs are used by popular LMS plugins which we provide integration for.
That is why we are hiding that CPT from the customizer in order to show it only for those LMS plugins and not conflict with other custom made CPT’s.
But if you don’t use an LMS plugin there is a filter that could bring back the support for your CPT.
Simply add this code in your child theme’s functions.php file or add this code through a snippets plugin like this one.
add_filter('blocksy:custom_post_types:supported_list', function ($cpts) {
if (get_post_type('course')) {
$cpts[] = 'course';
}
return $cpts;
});
Let us know if this helps.
Thanks @creativethemeshq for sharing the background. The code snippet did not help in bringing out the course post type in the customizer. I tested by adding another post type with a different name, and it worked fine. All the three post type were visible on customizer for customization. Looks like the slug, course, is cause of the issue as it is being used for integration with LMS. Maybe it will help if the documentation captures such dependency and lists slugs/terms to be avoided. Thanks again for your support!
@anandaravind Sad to hear that the above code snippet didn’t helped you.
I re-did the test on our end like this:
1. Declared a CPT with the slug course using the “Custom Post Type UI” plugin
2. Added the above code in the functions.php file of my child theme
3. Result: Courses showed up in the customizer
—
Now, it’s possible that the get_post_type('course') check could fail on your end , because our filter could be called slightly earlier than the moment when your plugin declares the CPT itself.
What you can try is whitelisting this CPT without the check at all, like this:
add_filter('blocksy:custom_post_types:supported_list', function ($cpts) {
$cpts[] = 'course';
return $cpts;
});
I believe with this code it should work properly in your case too.
Can you please give it a go and let us know how it performs for you?
Thanks and waiting for your reply.