Skip to content

Guidelines: Update actions-section and import/export workflow#76621

Open
aswasif007 wants to merge 6 commits intoWordPress:trunkfrom
aswasif007:update/actions-section
Open

Guidelines: Update actions-section and import/export workflow#76621
aswasif007 wants to merge 6 commits intoWordPress:trunkfrom
aswasif007:update/actions-section

Conversation

@aswasif007
Copy link
Contributor

@aswasif007 aswasif007 commented Mar 18, 2026

What?

Related issue: #76384

Refactors the Content Guidelines “Actions” section (import/export/revert) and improves the guidelines import/export flows.

Why?

  • Improve maintainability by extracting a dedicated action row component and consolidating rendering/styling.
  • Use ConfirmDialog component instead of using a custom modal to seek confirmation for import.
  • Make exports easier to track by including the export date in the downloaded filename.

How?

  • Render actions from a single ACTIONS definition and use a new GuidelineAction component for each row.
  • On import, clear categories/blocks not present in the JSON (so omissions remove existing guidelines instead of leaving stale values).
  • Export downloads as guidelines-YYYY-MM-DD.json.

Testing Instructions

  1. Open the Content Guidelines page/route.
  2. Scroll to Actions.
  3. Click Download and confirm the filename is guidelines-YYYY-MM-DD.json.
  4. Click Upload, select a valid guidelines JSON file, and confirm a dialog appears warning that current guidelines will be replaced.
  5. Click Continue and verify:
    • A success snackbar appears.
    • Guidelines update to match the imported content.
    • Categories/blocks omitted from the imported file are removed/cleared.
  6. Try importing an invalid JSON (or wrong schema) and verify an error Notice appears and is dismissible.
  7. Click View history and verify it navigates to revision history.

Move css to its own file
Create separate component for each action
- Update store only if the import is successful
- Handle missing categories by removing them if exist.
@github-actions
Copy link

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: 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.

@aswasif007 aswasif007 added [Type] Enhancement A suggestion for improvement. [Feature] Guidelines An experimental feature for adding site-wide editorial rules. labels Mar 19, 2026
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. [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant