Skip to content

Ability category slugs use slash separators rejected by WP core (causes ~30 _doingItWrong notices on init) #216

@chubes4

Description

@chubes4

Summary

DataMachineEvents\Abilities\AbilityCategories registers four category slugs that contain / separators:

public const EVENTS   = 'datamachine-events/events';
public const VENUES   = 'datamachine-events/venues';
public const TESTING  = 'datamachine-events/testing';
public const SETTINGS = 'datamachine-events/settings';

WordPress 6.9 core rejects these because WP_Ability_Categories_Registry::register() validates the slug against this regex:

/^[a-z0-9]+(?:-[a-z0-9]+)*$/

— which only allows lowercase alphanumerics and dashes. Slashes are not permitted. The category registrations silently fail, then every ability that tries to assign one of these categories fires a second _doingItWrong because the category "is not registered."

Source: wp-includes/abilities-api/class-wp-ability-categories-registry.php line 68.

Symptoms

On every site init, wp-content/debug.log fills with ~30 PHP notices:

[25-Apr-2026 14:33:40 UTC] PHP Notice:  Function WP_Ability_Categories_Registry::register was called incorrectly.
  Ability category slug must contain only lowercase alphanumeric characters and dashes.
  (in version 6.9.0)

[25-Apr-2026 14:33:40 UTC] PHP Notice:  Function WP_Abilities_Registry::register was called incorrectly.
  Ability category "datamachine-events/events" is not registered.
  Please register the ability category before assigning it to ability "data-machine-events/query-events".

The pattern repeats once per category (4 times) plus once per ability that references one (~25+ abilities), totaling ~30 notices per request.

Verified live on extrachill.com (data-machine-events v0.30.0, WordPress 6.9, PHP 8.4).

Functional impact

Beyond log noise, abilities are registered without a category. Means:

  • Abilities don't appear under their intended category in the chat agent UI
  • wp datamachine abilities list --category=datamachine-events/events returns empty
  • Permission filters keyed on category may not match
  • Discovery/grouping features that expect categorized abilities silently degrade

Root cause

Slug values mix two separators — data-machine-events (kebab) for the plugin namespace, then / for the sub-category. WP core's slug grammar doesn't support that. The pattern probably came from a misreading of how DM core ability slugs work (those allow / because they're full ability identifiers like datamachine/render-image-template, registered through a different code path that doesn't use the kebab regex).

Worth noting that DM core itself uses slash-separated ability slugs everywhere (datamachine/render-image-template, datamachine/run-flow) and those work fine. But ability categories are a separate registry with stricter slug validation.

Suggested fix

Replace / with - in the four category slugs:

public const EVENTS   = 'datamachine-events-events';      // or just 'events'
public const VENUES   = 'datamachine-events-venues';      // or just 'venues'
public const TESTING  = 'datamachine-events-testing';
public const SETTINGS = 'datamachine-events-settings';

…then bulk-update every 'category' => 'datamachine-events/...' reference across inc/Abilities/*.php. About 25–30 call sites — a single sed pass plus visual review. Drop-in compatible, no behavior change beyond categories actually getting registered this time.

Related

  • Discovered while migrating SlideGeneratorWeeklyRoundupSlideTemplate (Migrate Calendar and EventsMap blocks to @extrachill/api-client #64). The notice flood obscured a real Ability "data-machine-events/query-events" not found error during testing because the abilities never registered properly under their category.
  • Pre-existing in v0.29.4. Not introduced by recent brand tokens or OG card work.
  • Cosmetic in production (just notices, not errors), but pollutes debug.log and makes signal-to-noise on real errors worse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions