Skip to content

Align doing_action() and did_action() usage for category and ability registration in the Abilities API #112

@galatanovidiu

Description

@galatanovidiu

There’s an inconsistency in how the Abilities API handles the action checks for category and ability registration.

Current behavior:

  • Categories:
    • The doing_action( 'abilities_api_categories_init' ) check is performed directly inside the register() method.
    • This enforces registration only during the abilities_api_categories_init action.
  • Abilities:
    • The check is performed in the wrapper function wp_register_ability().
    • It uses did_action() instead, allowing registration even after the action has fired.

Discussion points:

  • Should both follow the same pattern for consistency across the API?
  • Should registration be restricted strictly to the init action (doing_action()), or remain flexible using did_action()?
  • Which level (core register() method vs wrapper function) should enforce this restriction?

Originally posted by @gziolo in #102 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions