Get value from $_GET or $_POST superglobals.
beans_get_or_post( string $needle, mixed $default = null )
Return: (string) Value if found, $default otherwise.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$needle | string | true | - | Name of the searched key. |
$default | mixed | false | null | Value 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;
}