Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c76d819
Merge pull request #58 from Automattic/main
GaryJones Oct 14, 2025
8d87f76
docs: Add detailed explanation for "Flush Rules" functionality in README
GaryJones Oct 15, 2025
71f2585
Merge pull request #59 from Automattic/docs/explain-flush-rules-button
GaryJones Oct 15, 2025
79a644a
Add wp-env configuration for local development
GaryJones Nov 5, 2025
67c2f74
Merge pull request #60 from Automattic/feat/wp-env-config
GaryJones Nov 5, 2025
2cf4d6a
Bump minimum WordPress version to 6.4
GaryJones Nov 6, 2025
e0b3862
Merge pull request #61 from Automattic/feat/bump-min-wp-6.4
GaryJones Nov 6, 2025
5bb2cbb
Standardize .editorconfig file
GaryJones Nov 6, 2025
dbd85ff
Merge pull request #62 from Automattic/feat/standardize-editorconfig
GaryJones Nov 6, 2025
721219a
Update composer.json
GaryJones Nov 6, 2025
2f13a4a
Merge pull request #63 from Automattic/update/normalize-composer-json
GaryJones Nov 6, 2025
56eaf41
ci: add Dependabot, lint scripts, and test infrastructure
GaryJones Dec 13, 2025
ae04abe
chore: standardise .gitignore and add .distignore
GaryJones Dec 13, 2025
8061824
Merge pull request #64 from Automattic/standardize/configs-and-ci
GaryJones Dec 14, 2025
f7d1fb0
Actions(deps): Bump actions/checkout in the actions group
dependabot[bot] Dec 14, 2025
bbcbf99
Composer(deps-dev): Update rector/rector requirement from ^1.2 to ^2.2
dependabot[bot] Dec 14, 2025
868bb14
Merge pull request #65 from Automattic/dependabot/github_actions/acti…
GaryJones Dec 14, 2025
55f846b
Merge pull request #66 from Automattic/dependabot/composer/rector/rec…
GaryJones Dec 14, 2025
6c6fdbd
chore: migrate dependabot reviewers to CODEOWNERS
GaryJones Dec 14, 2025
6d384ef
Merge pull request #67 from Automattic/chore/codeowners-migration
GaryJones Dec 14, 2025
b353290
ci: add integration test workflow
GaryJones Dec 17, 2025
feeaf7b
Merge pull request #68 from Automattic/add/integration-workflow
GaryJones Dec 17, 2025
f264f49
Version 1.6.0 changelog
GaryJones Jan 2, 2026
3a97133
Version 1.6.0 i18n
GaryJones Jan 2, 2026
e44fde3
Version 1.6.0
GaryJones Jan 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Directories
/.git/
/.github/
/bin/
/node_modules/
/tests/
/vendor/

# Files
.distignore
.editorconfig
.gitattributes
.gitignore
.phpcs.xml.dist
.wp-env.json
.wp-env.override.json
CHANGELOG.md
composer.json
composer.lock
package.json
package-lock.json
phpunit.xml.dist
5 changes: 3 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# It is based on https://core.trac.wordpress.org/browser/trunk/.editorconfig
# See https://editorconfig.org for more information about the standard.

# WordPress Coding Standards
# http://make.wordpress.org/core/handbook/coding-standards/
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The following teams will get auto-tagged for a review.
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @Automattic/vip-plugins
42 changes: 42 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration for Dependabot version updates
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
groups:
actions:
patterns: ["*"]
labels:
- "dependencies"
commit-message:
prefix: "Actions"
include: "scope"
open-pull-requests-limit: 5

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
day: "tuesday"
groups:
dev-dependencies:
patterns:
- "automattic/*"
- "dealerdirect/*"
- "php-parallel-lint/*"
- "phpcompatibility/*"
- "phpunit/*"
- "squizlabs/*"
- "yoast/*"
labels:
- "dependencies"
commit-message:
prefix: "Composer"
include: "scope"
open-pull-requests-limit: 5
versioning-strategy: increase-if-necessary
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
contents: read
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false

Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Run PHPUnit

on:
push:
branches:
- develop
- trunk
paths:
- '.github/workflows/integration.yml'
- '**.php'
- 'phpunit.xml.dist'
- 'composer.json'
pull_request:
paths:
- '.github/workflows/integration.yml'
- '**.php'
- 'phpunit.xml.dist'
- 'composer.json'
workflow_dispatch:

permissions:
contents: read

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
runs-on: ubuntu-latest

env:
WP_ENV_CORE: WordPress/WordPress#${{ matrix.wordpress }}

strategy:
matrix:
include:
# Check lowest supported WP version, with the lowest supported PHP.
- wordpress: '6.4'
php: '7.4'
# Check latest WP with the latest PHP.
- wordpress: 'master'
php: 'latest'
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false

- name: Install wordpress environment
run: npm install -g @wordpress/env

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php }}
tools: composer

- name: Install Composer dependencies
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Setup wp-env
run: wp-env start

- name: Run integration tests (single site)
run: composer test:integration

- name: Run integration tests (multisite)
run: composer test:integration-ms
17 changes: 14 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Dependencies
/node_modules/
/vendor/
.phpcs.xml
phpcs.xml
composer.lock

# Composer
/composer.lock

# Tests
/.phpunit.cache/

# Local config overrides
/.phpcs.xml
/phpcs.xml
/phpunit.xml
/.wp-env.override.json
4 changes: 2 additions & 2 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="wp-parsely" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Custom ruleset for wp-parsely plugin.</description>
<description>Custom ruleset for rewrite-rules-inspector plugin.</description>

<!-- For help in understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- For help in using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
Expand Down Expand Up @@ -39,7 +39,7 @@
<rule ref="WordPress-Docs"/>
<!-- For help in understanding these custom sniff properties:
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="5.9"/>
<config name="minimum_supported_wp_version" value="6.4"/>

<!-- Rules: WordPress VIP - see
https://github.com/Automattic/VIP-Coding-Standards -->
Expand Down
20 changes: 20 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"plugins": [
"."
],
"phpVersion": "7.4",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"SCRIPT_DEBUG": true
},
"lifecycleScripts": {
"afterStart": "wp-env run cli wp plugin install query-monitor --activate"
},
"env": {
"tests": {
"phpVersion": "8.4",
"core": "WordPress/WordPress#trunk"
}
}
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.6.0] - 2026-01-06

Minimum WordPress version is now 6.4.

### Changed

- chore: bump minimum WordPress version to 6.4 by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/61

### Documentation

- docs: add detailed explanation for "Flush Rules" functionality in README by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/59

### Maintenance

- chore: add wp-env configuration for local development by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/60
- chore: standardise .editorconfig file by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/62
- chore: normalise composer.json by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/63
- chore: standardise .gitignore and add .distignore by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/64
- ci: add Dependabot, lint scripts, and test infrastructure by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/64
- Composer(deps-dev): update rector/rector requirement from ^1.2 to ^2.2 by @dependabot in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/66
- Actions(deps): bump actions/checkout in the actions group by @dependabot in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/65
- chore: add CODEOWNERS file and migrate Dependabot reviewers by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/67
- ci: add integration test workflow and consolidate test bootstrap by @GaryJones in https://github.com/Automattic/Rewrite-Rules-Inspector/pull/68

## [1.5.1] - 2025-10-14

### Fixed
Expand Down Expand Up @@ -81,6 +105,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Filter by different sources of rewrite rules.
- An error message appears if rewrite rules are missing in the database.

[1.6.0]: https://github.com/Automattic/Rewrite-Rules-Inspector/compare/1.5.1...1.6.0
[1.5.1]: https://github.com/Automattic/Rewrite-Rules-Inspector/compare/1.5.0...1.5.1
[1.5.0]: https://github.com/Automattic/Rewrite-Rules-Inspector/compare/1.4.0...1.5.0
[1.4.0]: https://github.com/Automattic/Rewrite-Rules-Inspector/compare/1.3.1...1.4.0
Expand Down
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Rewrite Rules Inspector

Stable tag: 1.5.1
Requires at least: 5.9
Tested up to: 6.8
Stable tag: 1.6.0
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 7.4
License: GPLv2 or later
Tags: rewrite rules, tools
Contributors: danielbachhuber, automattic, tmoorewp, GaryJ
Contributors: danielbachhuber, automattic, tmoorewp, garyj

A simple admin tool for inspecting rewrite rules.

Expand Down Expand Up @@ -38,6 +38,44 @@ Browse a table of all **permastructs** that WordPress is aware of, including:
- **Structure** — the permalink structure pattern used to generate rules.
- **Description** — a human-friendly summary of what the permastruct controls.

### Flush Rules

The "Flush Rules" button allows you to regenerate your site's rewrite rules. Here's exactly what happens when you click it:

#### What the Flush Rules Button Does

When you click the "Flush Rules" button, the following sequence occurs:

1. **Security Check**: The system verifies you have the proper permissions (`manage_options` capability) and validates the security nonce to prevent unauthorized access.

2. **Cache Clearing**: WordPress deletes the cached rewrite rules from the options cache using `wp_cache_delete('rewrite_rules', 'options')`.

3. **Rule Regeneration**: WordPress calls `flush_rewrite_rules(false)` to regenerate all rewrite rules based on:
- Current permalink structure settings
- Custom post types and taxonomies
- Any custom rewrite rules added by themes or plugins

4. **Hook Execution**: The `rri_flush_rules` action hook is fired, allowing other plugins to perform additional cleanup or actions after the flush.

5. **Success Feedback**: You're redirected back to the Rewrite Rules Inspector page with a success message confirming the rules have been flushed.

#### When to Use Flush Rules

Use the "Flush Rules" button when:

- **Missing Rules**: You see rules marked as "missing" (red background) in the inspector
- **Custom URLs Not Working**: Your custom permalinks or post type URLs aren't working properly
- **After Plugin Changes**: You've activated/deactivated plugins that register custom rewrite rules
- **Permalink Structure Changes**: You've modified your site's permalink structure
- **Custom Post Type Issues**: New custom post types or taxonomies aren't generating proper URLs

#### Important Notes

- **Soft Flush**: This performs a "soft" flush (using `flush_rewrite_rules(false)`), which is safer than a hard flush as it doesn't force regeneration of all rules unnecessarily.
- **Permissions Required**: Only users with `manage_options` capability can flush rules.
- **No Data Loss**: Flushing rules doesn't delete any content or settings, it only regenerates the URL routing rules.
- **Immediate Effect**: Changes take effect immediately after flushing.

## Installation

### Install the plugin from within WordPress
Expand Down
Loading