Skip to content

Commit 893a0b9

Browse files
Abilities API: Align the content query docs with the sibling abilities
- Explain in the class docblock why the content ability lives in a dedicated class instead of a closure in wp_register_core_abilities(), as the users and settings classes do. - Say that an empty `fields` list, like an omitted one, returns the lean set of common read fields.
1 parent 171699b commit 893a0b9

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/wp-includes/abilities/class-wp-abilities-content.php‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
* by post type, status, author, parent, or included IDs. Raw fields are only returned for
1919
* posts the current user can edit.
2020
*
21-
* The class is intentionally structured around shared building blocks (exposed post type
22-
* discovery, schema generation, per-post formatting and permission checks) so future
23-
* write-oriented content abilities can reuse them.
21+
* Unlike the other core abilities, which are self-contained closures registered directly
22+
* in wp_register_core_abilities(), the content ability lives in a dedicated class because
23+
* its callbacks and schemas share helpers: the permission and execute callbacks resolve and
24+
* authorize the requested post through the same code, and the input schema, output schema,
25+
* and field projection are built from the same field definitions. Future write-oriented
26+
* content abilities can reuse them as well.
2427
*
2528
* This class is part of WordPress' internal implementation of the core abilities and is
2629
* not part of the public API. It may be changed or removed at any time without notice.
@@ -968,7 +971,7 @@ private function get_fields_input_schema(): array {
968971
'type' => 'string',
969972
'enum' => array_keys( $this->get_post_properties() ),
970973
),
971-
'description' => __( 'Limit each returned post to these fields. The `id` is always included. If omitted, a lean set of common read fields is returned. Explicit raw field requests require edit access.' ),
974+
'description' => __( 'Limit each returned post to these fields. The `id` is always included. If omitted or empty, a lean set of common read fields is returned. Explicit raw field requests require edit access.' ),
972975
);
973976
}
974977

0 commit comments

Comments
 (0)