Archived topic
Activating sections on custom post type
5 replies · Started by Jamal on September 8, 2017
Hi
A curious case here. My cpt is called "projekt" and when i use the filter
add_filter( 'generate_sections_post_types','generate_add_section_post_types' );
function generate_add_section_post_types() {
return array( 'page','post','Projekt' ); //<strong>Notice capital P</strong>
}
it results in this
http://i.imgur.com/2NddoPS.png
http://i.imgur.com/HA4qtb5.png
A simple solution is to use the correct cpt name in the filter but it took me ages to narrow down what was causing this #lol
That's strange - so that only happens when you use the incorrect name?
Yeah, after testing it some more its even getting stranger. Using something a random name, the filter doesn't take effect so all is good. When i capitalize one of the cpt name letters that's when it get crazy. I tried pRojket, projekT, PROJKET and all result in the screenshot above.
Interesting - I'll look into it.
Thank you!
Just thought I would add my comments for the next person who comes looking for this information.
My experience just now has been the opposite. From the advice of this thread, I capitalized the first letter of my CPT and that resulted in the screenshots above with sections NOT working correctly.
I reverted back to all lowercase in the PHP and it appears to be working correctly.
The value should be the exact slug (case sensitive) of your CPT.