Automattic / Automattic/VIP-Coding-Standards

Improve flush_rewrite_rules warning

Open
#701 1 comment 4 reactions 0 assignees View on GitHub
Type: Enhancement
Dominant language
PHP
Stars
261
Forks
44
Avg merge
19m
Merged PRs (30d)
1

Description

## What problem would the enhancement address for VIP?

Right now here's the rule that we see when you try to use `flush_rewrite_rules()`:

> 🚫 Error( severity 5 ): flush_rewrite_rules should not be used in any normal circumstances in the theme code (WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules).

I feel like adding more context here as to "why" would be helpful, and also adding cases where this might be appropriate? For example, what about in a plugin activation/deactivation hook?

## Describe the solution you'd like

1. Why should you not use it
2. When it might be ok to use
3. What the effect of using it would have
4. Link to a doc on docs.wpvip.com to more details

Contributor guide

Open the contributing guide

Research direction

Locate the PHP_CodeSniffer rule that emits the flush_rewrite_rules warning and review its existing message and related documentation. Update the warning to explain why the function is discouraged, when activation or deactivation hooks may be appropriate, its effects, and the relevant docs.wpvip.com link; verify the rule's tests if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
documentation, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.