Samuel Arendt

WordPress 7.2 changes the Abilities API: invalid input is now rejected and empty objects return as {}

WordPress 7.2, scheduled for release on December 8, 2026, changes how the Abilities API handles input and output. The Abilities API is the part of core where plugins register actions with a name, a permission check and a data schema, so that other plugins, the REST API and external clients, such as AI agent integrations, can discover and run them. The developer note published on November 19 on Make WordPress Core describes two changes that can break code that works today: input that fails sanitization is now rejected, and an empty object now comes out in JSON as {} instead of [].

What changes in 7.2

Every ability execution now goes through a new method, WP_Ability::prepare_input(), which runs three steps in this order: it normalizes the input (applying the schema default when the input is null), validates it against the input schema and sanitizes it. The permission and execute callbacks receive the prepared value. If any step fails, execution stops with the ability_invalid_input error before any callback runs, and the REST endpoint returns HTTP 400.

Up to 7.1, the REST endpoint fell back to the unsanitized input when one field failed. The note explains why that was risky: the string "false" could reach the permission callback, where it is truthy. In 7.2 that fallback is gone, and the REST controller method that provided it, sanitize_input_for_ability(), is deprecated and now returns the input unchanged.

Preparation also converts types. A number schema turns integers into floats in direct PHP calls (10 becomes 10.0), as the REST API already did. The string "false" becomes boolean false, and "1,2" becomes array( 1, 2 ) when the schema asks for a list of integers. Callbacks that check the type with is_int() on a number field will fail.

On output, the new wp_prepare_json_value_for_client() function uses the output schema to decide whether an empty PHP array becomes {} or []. The Abilities REST API and the WordPress AI Client already apply this rule. A direct call to $ability->execute() still returns the callback's raw result.

The release also adds a required_capabilities argument that lists the capabilities needed to run an ability. With it, permission_callback can be omitted when the list covers the whole check, but that only works from 7.2 onward.

Who needs to test

The note points to three groups:

  • plugins that register abilities and rely on the original input type or on values that sanitization strips (a text-field string loses its HTML tags);
  • plugins that call check_permissions(), normalize_input() or validate_input() directly, because check_permissions() does not prepare input and must be preceded by prepare_input();
  • clients and integrations that expect [] when the result is an empty object, and custom transports that serialize ability results.

Sites that only use third-party plugins do not need to change code, but they depend on those plugin authors testing before December 8. For teams with their own plugin or an agent integration built on the Abilities API, testing falls to whoever maintains that code. The article on ACF 6.8 and its Abilities API integration covers the decision to expose a site's structure to agents, and the 7.2 changes affect exactly that kind of integration.

What to do before December 8

The 7.2 RC1 shipped on November 17 and already includes these changes. The best approach is to run the plugin or integration tests against it now rather than waiting for the final release. The note recommends:

  • replacing the manual normalize-and-validate sequence with prepare_input() and checking for an error before calling check_permissions();
  • using an integer schema when the callback needs an integer;
  • declaring type: object or type: array explicitly in output schemas, including nested properties;
  • in custom transports, running the result through wp_prepare_json_value_for_client() with $ability->get_output_schema() just before JSON encoding;
  • in plugins that still support older versions, keeping permission_callback and checking that the new functions exist before calling them.

On the client side, it is worth searching the code that consumes the Abilities REST API for any comparison that treats an empty result as a list.

What is still open

The RC1 announcement gives the final date but not the RC2 and RC3 dates, and the note does not offer a way to turn off the rejection of invalid input. There is also no information on which third-party plugins that register abilities have already been updated. The note asks for compatibility problems to be reported on the Trac tickets linked to each change (#66325, #66383 and #66267), and 7.2 may still be adjusted before release.

If your company is weighing something similar or needs support on this topic, reach me on LinkedIn or WhatsApp.

References

Glass ceiling seen from below, with a lattice of metal triangles closing around an oval opening in the center.

Photo by Luke Ellis-Craven on Unsplash

#AI Agents, #Radar, #Software Quality