-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathrewrite-rules-inspector.php
More file actions
49 lines (44 loc) · 1.63 KB
/
rewrite-rules-inspector.php
File metadata and controls
49 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Rewrite Rules Inspector
*
* @package automattic\rewrite-rules-inspector
* @author Automattic, Daniel Bachhuber
* @copyright 2012 Automattic
* @license GPL-2.0-or-later
*
* @wordpress-plugin
* Plugin Name: Rewrite Rules Inspector
* Plugin URI: https://wordpress.org/plugins/rewrite-rules-inspector/
* Description: Simple WordPress admin tool for inspecting your rewrite rules.
* Version: 1.5.1
* Author: Automattic, Daniel Bachhuber
* Author URI: https://automattic.com/
* Text Domain: rewrite-rules-inspector
* License: GPL-2.0-or-later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* GitHub Plugin URI: https://github.com/Automattic/Rewrite-Rules-Inspector
* Requires PHP: 7.4
* Requires WP: 5.9.0
*/
require_once __DIR__ . '/rewrite-rules-inspector/rewrite-rules-inspector.php';
/**
* Place the rewrite rules view under the VIP dashboard instead of under tools.php
*/
add_filter( 'rri_parent_slug', function () {
return 'vip-dashboard';
} );
/**
* When a VIP switches their theme, make a request to flush and reload their rules
* It's less than ideal to do a remote request, but all of the new theme's code
* won't be loaded on this request
*/
add_action( 'switch_theme', 'rri_wpcom_action_switch_theme' );
function rri_wpcom_action_switch_theme() {
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules
flush_rewrite_rules();
}
/**
* Only allow the site to flush rules if the theme is whitelisted
*/
add_filter( 'rri_flushing_enabled', '__return_true' );