Automattic / Automattic/VIP-Coding-Standards

Improve flush_rewrite_rules warning

Đang mở
#701 1 bình luận 4 reaction 0 người được giao Xem trên GitHub
Type: Enhancement
Ngôn ngữ chính
PHP
Star
261
Fork
44
Merge trung bình
19 phút
Pull request đã merge (30 ngày)
1

Mô tả

## 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tìm rule PHP_CodeSniffer phát ra cảnh báo về flush_rewrite_rules và xem xét message hiện tại cùng tài liệu liên quan. Cập nhật cảnh báo để giải thích lý do không nên sử dụng function này, khi nào activation hook hoặc deactivation hook có thể phù hợp, các tác động của nó và liên kết docs.wpvip.com liên quan; kiểm tra các test của rule nếu có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
php, wordpress
Lĩnh vực
documentation, tooling
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.