Skip to content

Add core/post-types-query ability - #1106

Draft
jorgefilipecosta wants to merge 13 commits into
developfrom
add/core-post-types-query
Draft

jorgefilipecosta wants to merge 13 commits into
developfrom
add/core-post-types-query

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What?

Adds core/post-types-query, a read-only ability that reads the post types exposed to abilities.

How?

  • The ability lives in includes/Abilities/Post_Types/Post_Types.php, behind the Custom Abilities experiment.
  • Two modes: one post type by slug, or the exposed post types, returned as { post_types }.
  • Only post types with show_in_abilities can be read (post and page by default). Any other slug is treated as missing. Any logged-in user can read them.
  • Fields: name, slug, description, hierarchical, has_archive, taxonomies, icon, template, and template_lock are returned by default. capabilities, labels, supports, viewable, and visibility need permission to edit posts of the type, so asking for one lists only the post types the user can edit.

Testing Instructions

  1. Enable the Custom Abilities experiment.
  2. Run core/post-types-query with {}, { "slug": "page" }, and { "slug": "post", "fields": [ "name", "supports" ] }.
  3. npm run test:php -- --filter 'Post_Types|Gated_Abilities'
  4. npm run test:e2e -- tests/e2e/specs/abilities/core-post-types-query.spec.js

Changelog Entry

Added - New core/post-types-query ability that reads the post types exposed to abilities.

Open WordPress Playground Preview

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.79412% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.89%. Comparing base (da700e0) to head (27a385f).

Files with missing lines Patch % Lines
includes/Abilities/Post_Types/Post_Types.php 97.75% 6 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1106      +/-   ##
=============================================
+ Coverage      81.53%   81.89%   +0.35%     
- Complexity      3071     3127      +56     
=============================================
  Files            129      131       +2     
  Lines          12253    12525     +272     
=============================================
+ Hits            9991    10257     +266     
- Misses          2262     2268       +6     
Flag Coverage Δ
unit 81.89% <97.79%> (+0.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul

jeffpaul commented Oct 4, 2026

Copy link
Copy Markdown
Member

@jorgefilipecosta note that I'm holding off on requesting reviews until this comes out of draft status

@jeffpaul jeffpaul added this to the 1.5.0 milestone Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants