ap_isset_post_value( string $var, mixed $default = '' )

Description #

Check if $_REQUEST var exists and get value. If not return default.

Parameters #

  • $var
    string (Required) Variable name.
  • $default
    mixed (Optional) Default value. Default value: ''

Changelog #

VersionDescription
3.0.0Introduced.

Source #

File: includes/functions.php

function ap_isset_post_value( $var, $default = '' ) {
	if ( isset( $_REQUEST[ $var ] ) ) { // input var okay.
		return wp_unslash( $_REQUEST[ $var ] ); // input var okay, xss ok, sanitization ok.
	}

	return $default;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment