Rewrite Rules Inspector

Описание

A simple WordPress admin tool for inspecting rewrite rules. View a listing of all your rewrite rules, see which rewrite rules match a given URL (and the priorities they match in), or filter by different sources of rewrite rules. Perform a soft flush of your rewrite rules to regenerate them.

Developed on GitHub — pull requests are always welcome. Please leave feedback, questions, bug reports, and feature requests in the GitHub issues.

Where to find it

Go to Tools Rewrite Rules in the WordPress admin.

URL Tester

Quickly test any URL (or path) against your site’s rewrite rules:

  • See whether the URL would be a 404 or which rule would match first (the one WordPress uses).
  • View the list of all matching rules, in match priority order.
  • Inspect the query variables extracted from the match and the resulting final query WordPress would run.

Works with full URLs or paths and automatically handles sites installed in a subdirectory.

Permastructs

Browse a table of all permastructs that WordPress is aware of, including:

  • Name — the permastruct key (e.g. for posts, taxonomies, authors).
  • 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.

Скриншоты

  • See all of the rewrite rules and flush them or download them.

  • Test a URL against the rules to see which one(s) would match, and the priority they would match in.

  • Limit rules and URL testing results down to specificrule sources.

  • See which permastructs WordPress knows about.

Установка

Установите плагин через систему WordPress

  1. Откройте раздел «Плагины» из админ-панели WordPress и кликните «Добавить новый» вверху страницы.
  2. Найдите «rewrite-rules-inspector» с помощью строки поиска в правой части страницы.
  3. Нажмите «Установить сейчас», чтобы установить плагин.
  4. После установки нажмите «Активировать», чтобы активировать плагин на вашем сайте.

Установите плагин вручную

  1. Download the plugin from WordPress.org or get the latest release from our GitHub Releases page.
  2. Распакуйте загруженный архив.
  3. Загрузите всю папку rewrite-rules-inspector в вашу директорию /wp-content/plugins.
  4. Откройте раздел «Плагины» в админ-панели WordPress и найдите только что установленный плагин.
  5. Нажмите «Активировать», чтобы активировать плагин на вашем сайте.

Отзывы

07.11.2021
Whenever you change a custom post type, you must flush the rewrite rules. This plugin does in in a single click. Additionally it enables you to check your rewrite rules against your URLs to make sure everything is working as it should. This is one of my essential plugins.
25.03.2018
Love the plugin but noticed today, whilst debugging a new plugin I’m writting, that the plugin still uses the depreciated functions: screen_icon() and get_screen_icon(). Both have gone depreciated since 3.8.0 so I reckon a minor update to avoid these errors from popping up in the debug mode is worth the effort 🙂 The fix — with backwards compatibility (do we need that?) — would be to change: <?php screen_icon( 'tools' ); ?> into: <?php if ( function_exists('screen_icon') ) screen_icon( 'tools' ); ?> ___ (!) Notice: screen_icon is deprecated since version 3.8.0 with no alternative available. (!) Notice: get_screen_icon is deprecated since version 3.8.0 with no alternative available. Location ..\rewrite-rules-inspector.php:208
Посмотреть все 25 отзывов

Участники и разработчики

«Rewrite Rules Inspector» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:

Участники

«Rewrite Rules Inspector» переведён на 5 языков. Благодарим переводчиков за их работу.

Перевести «Rewrite Rules Inspector» на ваш язык.

Заинтересованы в разработке?

Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.

Журнал изменений

Смотрите журнал изменений.