Stylesheet doesn't load when CPT is excluded from search

When installing Cwicly on my site today, none of the block styles were showing up on the front-end. It worked perfectly on pages and even new CPTs I made on staging, but not on my existing CPTs.

This one took me a while to figure out, but I finally found the culprit.

If you have “exclude from search” enabled, Cwicly’s main stylesheet doesn’t load for that CPT:

Hope that’s helpful.

Hi @sunny,

Thanks for bringing this up.

Sadly, I don’t think we can do much here → #29418 (Taxonomy archive query not including all of its post types.) – WordPress Trac

It’s not that the stylesheet isn’t being loaded, but more so that the styles for any post contained within an exclude_from_search post type are not generated because it literally doesn’t exist outside its own scope (we basically can’t query it and don’t know it exists).

1 Like

Ah - that’s a strange WP limitation.

There are ways to work around it so it’s not a huge deal, but it might be worth for you to mention it in the docs somewhere in case others come across it as well.

3 Likes

Certainly @sunny! Thanks for bringing this up, as we hadn’t come across this issue. Also, I will dig a bit to see if there is a way to fix it on our side.

Really appreciate it.

1 Like