WordPress.org

Make WordPress Core

Changeset 36177


Ignore:
Timestamp:
01/05/2016 08:56:10 PM (6 years ago)
Author:
swissspidy
Message:

Query: Add a WP::remove_query_var() helper function.

This makes cleaning up public query vars easier.

Fixes #35234.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r36034 r36177  
    9494        if ( !in_array($qv, $this->public_query_vars) )
    9595            $this->public_query_vars[] = $qv;
     96    }
     97
     98    /**
     99     * Remove name from list of public query variables.
     100     *
     101     * @since 4.5.0
     102     *
     103     * @param string $name Query variable name.
     104     */
     105    public function remove_query_var( $name ) {
     106        $this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) );
    96107    }
    97108
Note: See TracChangeset for help on using the changeset viewer.