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 ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		return wp_unslash( $_REQUEST[ $var ] ); // phpcs:ignore WordPress.Security
	}

	return $default;
}

Leave a Reply

Your email address will not be published.

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

Add your comment