Skip to content

Abilities API: Declare the uri format for the link output of core/content-query - #15987

Closed
jorgefilipecosta wants to merge 2 commits into
WordPress:trunkfrom
jorgefilipecosta:fix/content-query-link-uri-format
Closed

jorgefilipecosta wants to merge 2 commits into
WordPress:trunkfrom
jorgefilipecosta:fix/content-query-link-uri-format

Conversation

@jorgefilipecosta

Copy link
Copy Markdown
Member

Follow-up to https://core.trac.wordpress.org/changeset/64388.

This PR declares the uri format for the link output of core/content-query, like the link output of core/users-query:

  • The link item output property is a string with format: uri. Its value is unchanged: the post permalink.
  • Tests cover the schema, and that results validate against the output schema for a published post, a draft (plain ?p=ID link) and a private page.

Trac ticket: https://core.trac.wordpress.org/ticket/66268

Testing

Verify unit tests are passing:

vendor/bin/phpunit tests/phpunit/tests/abilities-api/wpRegisterCoreContentAbility.php

Or read the ability schema in the editor console as an administrator:

wp.apiFetch( { path: '/wp-abilities/v1/abilities/core/content-query' } ).then( ( ability ) => ability.output_schema.properties.items.items.properties.link );

Before: {"type":"string","description":"The permalink URL."}
After: {"type":"string","format":"uri","description":"The permalink URL."}

AI disclosure: the change and tests were drafted with AI assistance (Claude Code) and reviewed by me.

…e/content-query`.

The `link` output of `core/users-query` declares the `uri` format, while the `core/content-query` permalink was a plain string. Declare the same format for the post permalink, so clients that check formats treat both links the same. Add coverage that a draft's plain `?p=ID` permalink, a published post's and a private page's pretty permalinks validate against the output schema.

Follow-up to [64388].

See #66268.
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jorgefilipecosta, gziolo.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This aligns the link schema with core/users-query and the REST posts endpoint, with coverage for both pretty and plain permalinks.

@jorgefilipecosta

jorgefilipecosta commented Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

Commit message:

Abilities API: Declare the `uri` format for the `link` output of `core/content-query`.

The post permalink in the `link` output was a plain string, while the `link` output of `core/users-query` declares the `uri` format. Declare the same format for the post permalink, so clients that check formats treat both links the same. The value is unchanged.

Developed in https://github.com/WordPress/wordpress-develop/pull/15987.

Follow-up to [64388].

Props jorgefilipecosta, gziolo.
Fixes #66268.

wporg-sync pushed a commit that referenced this pull request Nov 20, 2026
…e/content-query`.

The post permalink in the `link` output was a plain string, while the `link` output of `core/users-query` declares the `uri` format. Declare the same format for the post permalink, so clients that check formats treat both links the same. The value is unchanged.

Developed in #15987.

Follow-up to [64388].

Props jorgefilipecosta, gziolo.
Fixes #66268.

git-svn-id: https://develop.svn.wordpress.org/trunk@65724 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 20, 2026
…e/content-query`.

The post permalink in the `link` output was a plain string, while the `link` output of `core/users-query` declares the `uri` format. Declare the same format for the post permalink, so clients that check formats treat both links the same. The value is unchanged.

Developed in WordPress/wordpress-develop#15987.

Follow-up to [64388].

Props jorgefilipecosta, gziolo.
Fixes #66268.
Built from https://develop.svn.wordpress.org/trunk@65724


git-svn-id: http://core.svn.wordpress.org/trunk@64754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 65724
GitHub commit: a5c41fa

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Nov 20, 2026
arshidkv12 pushed a commit to arshidkv12/wordpress-develop that referenced this pull request Nov 21, 2026
…e/content-query`.

The post permalink in the `link` output was a plain string, while the `link` output of `core/users-query` declares the `uri` format. Declare the same format for the post permalink, so clients that check formats treat both links the same. The value is unchanged.

Developed in WordPress#15987.

Follow-up to [64388].

Props jorgefilipecosta, gziolo.
Fixes #66268.

git-svn-id: https://develop.svn.wordpress.org/trunk@65724 602fd350-edb4-49c9-b593-d223f7449a82
arshidkv12 pushed a commit to arshidkv12/wordpress-develop that referenced this pull request Nov 21, 2026
…e/content-query`.

The post permalink in the `link` output was a plain string, while the `link` output of `core/users-query` declares the `uri` format. Declare the same format for the post permalink, so clients that check formats treat both links the same. The value is unchanged.

Developed in WordPress#15987.

Follow-up to [64388].

Props jorgefilipecosta, gziolo.
Fixes #66268.

git-svn-id: https://develop.svn.wordpress.org/trunk@65724 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants