ap_isset_post_value( string $val, mixed $default_val = '' )

Description #

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

Parameters #

  • $val
    string (Required) Variable name.
  • $default_val
    mixed (Optional) Default value. Default value: ''

Changelog #

VersionDescription
3.0.0Introduced.

Source #

File: includes/functions.php

function ap_isset_post_value( $val, $default_val = '' ) {
	if ( isset( $_REQUEST[ $val ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		return wp_unslash( $_REQUEST[ $val ] ); // phpcs:ignore WordPress.Security
	}

	return $default_val;
}

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