Skip to content

Commit

Permalink
Add amp prefix for define_query_var function; make sure constant defi…
Browse files Browse the repository at this point in the history
…ned before use
  • Loading branch information
westonruter committed Dec 7, 2017
1 parent ced9461 commit 1134bb1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function amp_init() {

load_plugin_textdomain( 'amp', false, plugin_basename( AMP__DIR__ ) . '/languages' );

amp_define_query_var();
add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK );

add_filter( 'request', 'amp_force_query_var_value' );
Expand All @@ -83,7 +84,11 @@ function amp_init() {
*
* @since 0.6
*/
function define_query_var() {
function amp_define_query_var() {
if ( defined( 'AMP_QUERY_VAR' ) ) {
return;
}

/**
* Filter the AMP query variable.
*
Expand All @@ -92,7 +97,7 @@ function define_query_var() {
*/
define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
}
add_action( 'after_setup_theme', 'define_query_var', 3 );
add_action( 'after_setup_theme', 'amp_define_query_var', 3 );

// Make sure the `amp` query var has an explicit value.
// Avoids issues when filtering the deprecated `query_string` hook.
Expand Down

0 comments on commit 1134bb1

Please sign in to comment.