wp_reset_vars

Definition:
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.

Parameters

  • 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 = '';

			else

				$$var = $_GET[$var];

		} else {

			$$var = $_POST[$var];

		}

	}

}

4059

About these ads

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

Follow

Get every new post delivered to your Inbox.

Join 150 other followers

%d bloggers like this: