soflyy/oxygen-bugs-and-features

`ct_template` registered as `public`

Closed this issue ยท 7 comments

Is there a reason that the ct_template post type is registered as public, publicly_queryable and has_archive? Edit: Doing so can cause the ct_template post type to incorrectly show in some site maps:

image

$args = array(
		'exclude_from_search' => true, 
		'labels'             => $labels,
		'public'             => true,
		'publicly_queryable' => true,
		'has_archive'	     => true,
		'show_ui'            => true,
		'show_in_menu'       => 'ct_template',
		'rewrite' 	     => false,
		'query_var'          => true,
		'capability_type'    => 'post',
		'hierarchical'       => false,
		'menu_position'      => null,
		'supports'           => array( 'title' )
);

register_post_type( 'ct_template', $args );

Thanks for clarifying ๐Ÿ™

Hello @perrelet,

Please open a Support Ticket (https://oxygenbuilder.com/support) with your question as this isn't a bug.

Hi @Kpudlo,

So, ct_template is supposed to be publicly queryable, meaning it serves a purpose beyond administrating layouts, i.e., the templates are for the public to be queried as-is?

I can only assume the following since your code is gated.

But, to work around this publicly queryable post type, there are probably many checks to prevent indexing and public visibility instead of letting WordPress handle the publicly queryable part via the publicly_queryable and public parameters.

For example, it's filtered from Yoast SEO, AIOSEO, and Rank Math's sitemaps, plus a host of other plugins must manually exclude it for you (see https://wpdirectory.net/search/01HQYAMBWCXDN5VCJA4FKM790H), or they'd face this bug as well.

Setting publicly_queryable to false would allow hundreds of lines of compatibility code to be dropped; it'd solve many support questions and stop bothering other devs. It'll dissolve the technical debt.

Again, I do not have access to the code, so I can only assume. But if it bugs like a bug, bugs like a bug, and bugs like a bug, it's probably a bug.

Here is a list of sites affected by this bug: https://www.google.com/search?q=inurl%3A%2Fct_template%2F+-npm.

Bug.

@sybrew Thank you for saving me the time to explain the situation here. ๐Ÿ™

@Kpudlo ct_template shows up in sitemaps, in what universe is this not a bug? ๐Ÿž

image

I can't help but bring up #3485 since both pertain to a post type's public option. Whilst this issue challenges how oxygen registers it's own post type, #3485 questions how oxygen extends those registered by third parties.

The issue is titled "ct_template registered as public" and the body of the original message simply asked:

Is there a reason that the ct_template post type is registered as public, publicly_queryable and has_archive?

This is not a bug report. This is a question. This repository is for bug reports, not general enquiries as to the functionality of our software.

ct_template shows up in sitemaps, in what universe is this not a bug?

This wasn't mentioned at all in the original issue. In this universe, we close issues that are generic questions about our software when they get posted in our bug reports & feature requests repository.

So, ct_template is supposed to be publicly queryable, meaning it serves a purpose beyond administrating layouts, i.e., the templates are for the public to be queried as-is?

Yes. It always has been.

register_post_type( 'ct_template', $args ); was written in our code 9 years ago.

The publicly_queryable arg was written 9 years ago.

People have been building Oxygen sites with this in place for 9 years without any notable side effects.

Again, I do not have access to the code, so I can only assume. But if it bugs like a bug, bugs like a bug, and bugs like a bug, it's probably a bug.

Sure, if the original issue had mentioned ct_template being included in sitemaps when it shouldn't be, it would be a bug report. But it did not and is not a bug report and will remain closed.

Additionally, as you said:

For example, it's filtered from Yoast SEO, AIOSEO, and Rank Math's sitemaps, plus a host of other plugins must manually exclude it for you (see https://wpdirectory.net/search/01HQYAMBWCXDN5VCJA4FKM790H), or face this bug as well?

As far as I can tell we do no special filtering or exclusions for Yoast, AIOSEO, or Rank Math site maps.

If you want to open a new issue that is an actual bug report, you're free to do that. Include the details of the bug (e.g. unintended side effect of some code in our software) and the actual problems it is causing. While you're at it, please explain why this is a problem for The SEO Framework but has impacted literally no other reputable SEO plugin for the last 9 years and how that's a bug in our software and not yours.

If you want to ask questions about how Oxygen works or why we made certain decisions in our code, email support@oxygenbuilder.com. This repository isn't for those questions.

@Spellhammer I understand your frustration, the point about sitemaps wasn't explicit in the question. I assumed it was implicit though, my bad.

Is there a reason that the ct_template post type is registered as public, publicly_queryable and has_archive?

This is a valid question since the logic doesn't follow the WordPress api. - I'll ask via email as requested โœ‰

This is not a bug report. This is a question. This repository is for bug reports, not general enquiries as to the functionality of our software [...] Sure, if the original issue had mentioned ct_template being included in sitemaps when it shouldn't be, it would be a bug report. But it did not and is not a bug report and will remain closed.

I'll edit my question to mention site maps ๐Ÿš€

The publicly_queryable arg was written 9 years ago.

Sure - but why? ๐Ÿค”

As far as I can tell we do no special filtering or exclusions for Yoast, AIOSEO, or Rank Math site maps.

No, but many do for you! ๐Ÿคฏ

https://wpdirectory.net/search/01HQYSTG3357KBT37H203PDEVV

image

While you're at it, please explain why this is a problem for The SEO Framework but has impacted literally no other reputable SEO plugin for the last 9 years and how that's a bug in our software and not yours.

Absolutely:

๐Ÿ‘‰ sybrew/the-seo-framework#666 ๐Ÿ‘ˆ

I've dealt with the public/publicly_queryable issue for the better part of my life, and many plugin authors conceded on this issue without a second thought. Public means accessible to everyone: Google, Bing, visitors, admins, a cat walking on a keyboard, etc.

If it isn't meant to be available to everyone, the publicly_queryable statement is misplaced, and every (new) API (Core sitemaps, REST) needs to have the post type filtered out. This is part of code debt: You must maintain it until it's fixed. I'd rather create cool new things than forever fix issues I didn't make.

I've also been dealing with stoic devs who think, "It's been there for 12+ years, so it works as intended," while the APIs have evolved indistinguishably, and that's their staple of all the 1-star reviews they deserved. In fact, it happened again yesterday, so please excuse my trenchancy. It's nothing personal; I'm just perpetually annoyed.

P.S. https://wpdirectory.net/search/01HQYSTG3357KBT37H203PDEVV indeed displays 4 SEO plugins that addressed this bug.

Hi @Kpudlo & @Spellhammer, please reconsider the issue instead of defaulting to "no one discovered it before, so it should be fine."

Here's another user reporting this issue: https://wordpress.org/support/topic/wrong-archive-template-url-in-sitemap-xml/.