Skip to content

Custom post types not detected as supported when registered after byline-manager plugin loads #524

@ellm

Description

@ellm

Description of the bug

The byline manager slotfill component does not appear in the block editor for custom post types that have author support when those post types are registered by plugins that load after byline-manager in the plugin loading order.

Expected Behavior
When editing a post of a custom post type that has 'author' in its supports array, the byline manager slotfill should appear in the block editor sidebar, regardless of the order in which plugins are loaded.

Actual Behavior
The slotfill does not appear for custom post types when:

  • The custom post type plugin loads after byline-manager
  • Even though the custom post type is registered with 'supports' => ['author', ...]
  • Even though get_post_types_by_support('author') eventually returns the custom post type

Steps To Reproduce

  1. Ensure byline-manager loads before a plugin that registers custom post types
  2. Have the other plugin register a custom post type with 'supports' => ['author', 'editor', 'title']
  3. Navigate to create/edit a post of that custom post type
  4. Observe that the byline manager slotfill is missing from the block editor

Additional Information

The issue appears to be related to timing and caching problems in how supported post types are determined:

  • Static Caching Issue: The Utils::get_supported_post_types() method uses static caching that may cache an incomplete list of post types if called before all custom post types are registered.
  • Hook Timing: The enqueue_block_editor_assets hook may fire before the byline taxonomy is fully registered with all supported post types.
  • Post Type Detection: During enqueue_block_editor_assets, get_post_type() may not reliably return the correct post type for the current editing context.

This issue particularly affects sites that:

  • Multiple plugins register custom post types
  • Plugin loading order varies (alphabetical, manual loading, etc.)
  • Custom post types need byline management functionality

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions