undefined function add_shortcode ()
-
I’m trying to work my way through some WordPress tutorials / exorcises (Using nonces) and I keep getting this PHP error. It’s telling me I have a call to undefined function add_shortcode () on line 32.
I’ve been digging for about a day now and can’t find what might be the problem. I’ve looked into stuff specifically on shortcodes and how to build and use them. That doesn’t suggest anything. I’ve looked and looked for any type-Os, missing () or curly braces etc.
I’m just not seeing it.Here’s the code…
<?php /* * plugin name: my_nonce * plugin URI: https://ronc.me * discription: A sample of the "wp_nonce-field ()" function * Author: ronc * Author URI:https://ronc.me */ function my_nonce_form() { ob_start() ?> <form method="post" > <p> <input type="hidden" name="my_nonce_field" value="<?php echo wp_create_nonce('my-nonce-field'); ?>" /> <input type="submit" value="Submit" /> </p> </form> <?php return ob_get_clean (); } add_shortcode('nonce_form', 'my_nonce_form'); function process_my_nonce_field() { if(isset($_post[my_nonce_form])){ if (wp_verify_nonce ($_post [my_nonce_form])) { } } } add_action ('init', 'my_nonce_form_data'); ?>
Is there something else that I’m missing or maybe some special nuance that I’m just not aware of ??
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘undefined function add_shortcode ()’ is closed to new replies.