function wp_reset_vars( $vars ) {}

Resets global variables based on $_GET and $_POST
This function resets global variables based on the names passed in the $vars array to the value of $_POST[$var] or $_GET[$var] or ” if neither is defined.


  • array $vars: An array of globals to reset.

Source code

function wp_reset_vars( $vars ) {

	for ( $i=0; $i<count( $vars ); $i += 1 ) {

		$var = $vars[$i];

		global $$var;

		if ( empty( $_POST[$var] ) ) {

			if ( empty( $_GET[$var] ) )

				$$var = '';


				$$var = $_GET[$var];

		} else {

			$$var = $_POST[$var];





No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 1,790 other followers

%d bloggers like this: