Skip to content

Categories and Tags panels show even when taxonomies are unregistered for the post type #111

@kraftbj

Description

@kraftbj

When a site unregisters a taxonomy for the post type used by Press This (e.g. unregister_taxonomy_for_object_type( 'post_tag', 'post' )), the Tags and Categories panels still appear in the editor.

The current code checks user capabilities via get_taxonomy()->cap, but get_taxonomy() returns the taxonomy object even when it's no longer associated with the post type. The panels should only display when the taxonomy is actually registered for the post type.

Steps to reproduce:

  1. Add unregister_taxonomy_for_object_type( 'post_tag', 'post' ) to a plugin or theme
  2. Open Press This
  3. The Tags panel still appears in the sidebar

Expected: The Tags panel should be hidden.

Fix: Use is_object_in_taxonomy() to check taxonomy registration for the post type before checking capabilities and querying terms.

Originally reported in https://wordpress.org/support/topic/issues-with-the-updated-press-this/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions