Browse Source

Move flush_rewrite_rules to install()

It adds significant overhead to each pageload and is only needed when
the rules change (aka after install).
master
Mahmoud Al-Qudsi 1 year ago
parent
commit
8ad7ef9d8f
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      bootstrap.php

+ 3
- 3
bootstrap.php View File

@@ -83,6 +83,7 @@ class visitors_edits{
83 83
 
84 84
 		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
85 85
 		dbDelta( $sql );
86
+		flush_rewrite_rules(true);
86 87
 	}
87 88
 	public function query_vars($query_vars){
88 89
 		$query_vars[] = 'visitors_edits_post_name';
@@ -94,7 +95,6 @@ class visitors_edits{
94 95
 	        'index.php?visitors_edits_post_name=$matches[1]',
95 96
 	        'top'
96 97
 	    );
97
-	    flush_rewrite_rules(true);
98 98
 	}
99 99
 	public function parse_request($request){
100 100
 		if( isset( $request->query_vars['visitors_edits_post_name'] ) ):
@@ -126,10 +126,10 @@ function visitors_editsDIFF($oldHtml,$newHtml){
126 126
 	require "vendor/autoload.php";
127 127
 	$htmlDiff = new HtmlDiff($oldHtml, $newHtml);
128 128
 	$htmlDiff->getConfig()->setGroupDiffs(false);
129
-	
129
+
130 130
 	return $htmlDiff->build();
131 131
 }
132 132
 function visitors_editsDOM(){
133 133
 	return new Dom;
134 134
 }
135
-?>
135
+?>

Loading…
Cancel
Save