Skip to content

CPT is still listed in Search Appearance settings even when removed from "accessible post types" #16558

@florianziegler

Description

@florianziegler
  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

I am using your wpseo_accessible_post_types filter to remove a public (as in 'public' => true) custom post type from being handled (for lack of a better word) by your plugin.

It works fine in removing – for example – the xml sitemap for that post type, the custom columns in the overview and the meta box.

But, the cpt is still listed under "Search Appearance > Content Types".

Please describe what you expected to happen and why.

I expected the excluded post type not to be visible here, as the settings do not matter anyway, because the post type is excluded by the filter mentioned above.

Looking at the code, you seem to be displaying the settings for all "public" post types, where as you should be displaying them for only the "accessible" (as you call them) post types.

How can we reproduce this behavior?

  1. Exclude a public cpt using the wpseo_accessible_post_types filter
  2. In WordPress Admin go to "SEO > Search Appearance > Content Types"
  3. Scroll down to see the cpt still listed

Technical info

  • If relevant, which editor is affected (or editors):
  • Classic Editor
  • Gutenberg
  • Classic Editor plugin
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other

Used versions

  • WordPress version: 5.6
  • Yoast SEO version: 15.6.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions