Questions about meta box: nonce and parameters available
-
16-10-2019 - |
Question
1st question is: is a nonce required for a meta box? i read on the wordpress codex add_meta_box
and they have a nonce for the meta box, i'd thought that maybe the add post form will already include a nonce?
echo '<input type="hidden" name="myplugin_noncename" id="myplugin_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
2nd question is: whats the parameters available for the function that creates the markup of the meta box. from what i read in profesional wordpress looks like
function pp_meta($post, $box)
how will i know what parameters are available in such functions? and what does box
refer to?
Solution
Not sure about nonces.
As for arguments it is probably their usage of add_meta_box():
$callback_args (array) (optional) Arguments to pass into your callback function. The callback will receive the $post object and whatever parameters are passed through this variable. Default: null
So $post
is post object and $box
is whatever they are passing in $callback_args