Skip to content

Fixed - Filter Guidelines service queries by wp_guideline_type=content - #531

Closed
itsgajendraSingh wants to merge 1 commit into
WordPress:trunkfrom
itsgajendraSingh:fix/529-filter-guidelines-by-content-type
Closed

Fixed - Filter Guidelines service queries by wp_guideline_type=content#531
itsgajendraSingh wants to merge 1 commit into
WordPress:trunkfrom
itsgajendraSingh:fix/529-filter-guidelines-by-content-type

Conversation

@itsgajendraSingh

@itsgajendraSingh itsgajendraSingh commented May 9, 2026

Copy link
Copy Markdown

Summary

  • Adds a GUIDELINE_TYPE_TAXONOMY constant (wp_guideline_type) and a private GUIDELINE_TYPE_CONTENT constant (content) to the Guidelines service.
  • When the wp_guideline_type taxonomy is registered (Gutenberg 23.1+), fetch_guidelines() now appends a tax_query to restrict the query to posts assigned the content term, preventing a newer artifact guideline from shadowing the intended content guideline during prompt assembly.
  • Falls back to the previous unfiltered query on sites running Gutenberg < 23.1 where the taxonomy does not exist.

Fixes #529.

Changes

  • includes/Services/Guidelines.php — add constants, conditionally add tax_query in fetch_guidelines().
  • tests/Integration/Includes/Services/Guidelines_CPT_Helpers.php — add register_guideline_type_taxonomy() helper; extend create_guidelines_post() with an optional $guideline_type parameter.
  • tests/Integration/Includes/Services/Guidelines_Test.php — add two new tests covering the mixed artifact/content scenario and the untyped-post edge case.

Test plan

  • Existing Guidelines_Test suite still passes.
  • test_get_guidelines_ignores_artifact_type_when_taxonomy_exists confirms the content guideline is returned when a newer artifact guideline also exists.
  • test_get_guidelines_returns_null_for_untyped_post_when_taxonomy_exists confirms untyped posts are excluded when the taxonomy is present.
  • Manual: install Gutenberg 23.1.x, reproduce steps from Filter Guidelines service queries by content guideline type #529, verify the correct content guideline is used in prompt assembly.
Open WordPress Playground Preview

When the wp_guideline_type taxonomy is registered (Gutenberg 23.1+),
a newer artifact guideline could be selected instead of the intended
content guideline during prompt assembly. Add a tax_query to restrict
fetched posts to the 'content' term when the taxonomy exists.

Fixes WordPress#529
@github-actions

github-actions Bot commented May 9, 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. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @gajendraSingh26.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: gajendraSingh26.


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

@itsgajendraSingh
itsgajendraSingh deleted the fix/529-filter-guidelines-by-content-type branch May 9, 2026 14:32
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