Skip to content

Guidelines CPT: Rename references from content guidelines to guidelines#77223

Open
iamchughmayank wants to merge 4 commits intoWordPress:trunkfrom
iamchughmayank:update/guidelines-class-file-rename
Open

Guidelines CPT: Rename references from content guidelines to guidelines#77223
iamchughmayank wants to merge 4 commits intoWordPress:trunkfrom
iamchughmayank:update/guidelines-class-file-rename

Conversation

@iamchughmayank
Copy link
Copy Markdown
Contributor

@iamchughmayank iamchughmayank commented Apr 10, 2026

What?

Follow-up to #77147 (CPT slug rename). See #76384.

Renames all internal references from "Content Guidelines" to "Guidelines" — class names, file names, directories, experiment flag, REST base, Redux store, CSS class prefix, meta keys, and route package name.

Why?

Before the 22.7 release, the public-facing name was simplified from "Content Guidelines" to just "Guidelines" — recognizing the feature extends beyond content to design guidelines, coding standards, and more (announcement
post
).

In #77147, the CPT slug was aligned to wp_guideline. As noted in the review, the rest of the code still referenced the old "Content Guidelines" naming. This PR completes that
alignment.

How?

PHP:

  • Classes: Gutenberg_Content_Guidelines_*Gutenberg_Guidelines_*
  • Files: class-gutenberg-content-guidelines-*class-gutenberg-guidelines-*
  • Directory: lib/experimental/content-guidelines/lib/experimental/guidelines/
  • Functions: gutenberg_*_content_guidelines_*gutenberg_*_guidelines_*

Identifiers:

  • Experiment flag: gutenberg-content-guidelinesgutenberg-guidelines
  • REST base: content-guidelinesguidelines
  • Meta keys: _content_guideline_*_guideline_*
  • Redux store: core/content-guidelinescore/guidelines
  • CSS prefix: .content-guidelines__.guidelines__
  • Package: @wordpress/content-guidelines-route@wordpress/guidelines-route

Unchanged: Admin page slug (guidelines-wp-admin), render function names that already use "guidelines" without "content".

Testing Instructions

Setup: npm run wp-env start

  1. Navigate to Settings > Experiments, enable Guidelines, save.
  2. Navigate to Settings > Guidelines.
  3. Add text in Copy and Images fields, click Save.
  4. Refresh — verify saved guidelines load correctly.
  5. In browser devtools (Network tab), verify the fetch to /wp/v2/guidelines returns data while on the Guidelines admin page.
  6. Run PHPUnit tests: vendor/bin/phpunit --filter Gutenberg_Guidelines — all 31 tests pass.
  7. Run e2e tests: npm run test:e2e -- test/e2e/specs/admin/guidelines.spec.js — all 3 tests pass.

Testing Instructions for Keyboard

No special keyboard testing required.

Screenshots or screencast

No visual changes.

Use of AI Tools

Claude Opus used for planning the rename scope and executing the find-and-replace across the codebase.

@iamchughmayank iamchughmayank force-pushed the update/guidelines-class-file-rename branch from fdeaf8d to 3885710 Compare April 10, 2026 09:34
@iamchughmayank
Copy link
Copy Markdown
Contributor Author

Since this is experimental feature, perhaps, the Core back port may not be required. I understand that adding a specific label should skip the CI check failure of "Verify Core Backport"

@iamchughmayank iamchughmayank marked this pull request as ready for review April 10, 2026 09:38
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

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.

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

Co-authored-by: iamchughmayank <iamchughmayank@git.wordpress.org>
Co-authored-by: aagam-shah <aagam94@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: aswasif007 <aswasif007@git.wordpress.org>

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

@gziolo gziolo added [Type] Enhancement A suggestion for improvement. [Feature] Guidelines An experimental feature for adding site-wide editorial rules. No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core labels Apr 10, 2026
@gziolo
Copy link
Copy Markdown
Member

gziolo commented Apr 10, 2026

Nice, thank you for working on the follow-up. The changes are straightforward, so it mostly needs some testing.

@gziolo gziolo added [Type] Breaking Change For PRs that introduce a change that will break existing functionality and removed [Type] Enhancement A suggestion for improvement. labels Apr 10, 2026
Copy link
Copy Markdown
Contributor

@aagam-shah aagam-shah left a comment

Choose a reason for hiding this comment

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

Nice cleanup @iamchughmayank — the mechanical rename is thorough and consistent across PHP, JS, SCSS, and tests. A couple of concerns:

Incomplete JS/TS internal rename: The store STORE_NAME and CSS classes were renamed, but all JS/TS identifiers still say "ContentGuidelines" — fetchContentGuidelines, ContentGuidelinesState, coreContentGuidelinesStore, etc. Not blocking since these are private to the route package, but worth noting whether this is intentional or a follow-up.

Nit: package-lock.json includes an unrelated @babel/eslint-parser version hoist — lockfile regeneration noise.

@aswasif007
Copy link
Copy Markdown
Contributor

aswasif007 commented Apr 10, 2026

Few observations:

  • The rest_base rename from content-guidelines to guidelines and meta key prefix rename from content_guideline to guideline are breaking changes for any existing stored data. Posts saved with old meta keys won't be readable under the new keys without a migration. I supposed we already know that and fine with it, but still raising just in case.
  • Four JSDoc/inline comments in the codebase still reference "content guidelines" instead of "guidelines":
    api.ts ~L113: * Opens file selector, reads the selected file and imports the content guidelines.
    api.ts ~L114: * @param file Content Guidelines JSON file
    api.ts ~L177: * Exports the content guidelines as a JSON file.
    stage.tsx ~L66: // Populate the store with the content guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Guidelines An experimental feature for adding site-wide editorial rules. No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Type] Breaking Change For PRs that introduce a change that will break existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants