I just started to learn PHP and doing things with WordPress and I am a bit confused about information in Codex. Was told that Codex got all info I required but I got stuck with it.
What array fields are in $_REQUEST
in WordPress? Can not find it in Codex.
E.g.: people use
$my_contact = $_REQUEST['contact'];
How do they know $_REQUEST
has 'contact'
field?
Is there any workflow to find informations about variables which are not described in Codex? Should I print off all the array to see what fields are inside?
Google does not help me.. about $_REQUEST.
5 s
This is mostly pure PHP, but it does have WordPress twist.
PHP has number of superglobal variables, that contain information relevant to current request. Out of those:
$_GET
contains info from URL (HTTP GET request)$_POST
info from form submission (HTTP POST request)$_COOKIES
about cookies set- and
$_REQUEST
is combination of the above (according to docs$_COOKIES
can be commonly configured to skip for better security)
However WP enforces its own logic – during load process wp_magic_quotes()
processes variables to emulate magic quotes setting and enforces $_REQUEST
to contain combination of $_GET
and $_POST
, no matter what PHP configuration says.
So in WordPress environment it will contain GET and/or POST request data. What data exactly that is will depend entirely which page you are on and what is happening on it.