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

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: