Skip to content

Commit

Permalink
fix(BaseStyle): correct query_vars check
Browse files Browse the repository at this point in the history
and do not flush rewrite rules
  • Loading branch information
domtra committed Nov 22, 2019
1 parent d41bddd commit 051c81a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions inc/baseStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@
function registerRewriteRule()
{
$routeName = ROUTENAME;
$routeString = "{$routeName}/?(.*?)/?$";

add_rewrite_rule("{$routeName}/?(.*?)/?$", "index.php?{$routeName}=\$matches[1]", "top");
add_rewrite_rule($routeString, "index.php?{$routeName}=\$matches[1]", "top");
add_rewrite_tag("%{$routeName}%", "([^&]+)");

$rules = get_option('rewrite_rules');

if (! isset($rules["{$routeName}/(.*?)/?$"])) {
flush_rewrite_rules();
}
}

function disallowRobots()
Expand All @@ -43,7 +38,7 @@ function templateInclude($template)
{
global $wp_query;

if (isset($wp_query->query_vars['BaseStyle'])) {
if (isset($wp_query->query_vars[ROUTENAME])) {
disallowRobots();
return get_template_directory() . '/basestyle.php';
}
Expand Down

0 comments on commit 051c81a

Please sign in to comment.