beans_get_or_post

Get value from $_GET or $_POST superglobals.

beans_get_or_post( string $needle, mixed $default = null )

Return: (string) Value if found, $default otherwise.

Parameters

NameTypeRequiredDefaultDescription
$needlestringtrue-Name of the searched key.
$defaultmixedfalsenullValue returned if the searched key isn't found.

Source

function beans_get_or_post( $needle, $default = null ) {

	if ( $get = beans_get( $needle ) ) {
		return $get;
	}

	if ( $post = beans_post( $needle ) ) {
		return $post;
	}

	return $default;

}