From 8ad7ef9d8fc8880c821e4c9e5be7906b1c4d2f35 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 10 Feb 2018 13:22:31 -0600 Subject: [PATCH] Move flush_rewrite_rules to install() It adds significant overhead to each pageload and is only needed when the rules change (aka after install). --- bootstrap.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index 2a947eb..4a46fde 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -83,6 +83,7 @@ class visitors_edits{ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); + flush_rewrite_rules(true); } public function query_vars($query_vars){ $query_vars[] = 'visitors_edits_post_name'; @@ -94,7 +95,6 @@ class visitors_edits{ 'index.php?visitors_edits_post_name=$matches[1]', 'top' ); - flush_rewrite_rules(true); } public function parse_request($request){ if( isset( $request->query_vars['visitors_edits_post_name'] ) ): @@ -126,10 +126,10 @@ function visitors_editsDIFF($oldHtml,$newHtml){ require "vendor/autoload.php"; $htmlDiff = new HtmlDiff($oldHtml, $newHtml); $htmlDiff->getConfig()->setGroupDiffs(false); - + return $htmlDiff->build(); } function visitors_editsDOM(){ return new Dom; } -?> \ No newline at end of file +?>