I am trying to create a frontend edit profile form that mimics the wp-admin backend edit profile. I created the form as HTML directly in a WordPress page (I'm a PHP/WordPress beginner, so I don't know how to write plugins), using shortcode plugins (see technical notes) to correctly populate the form.
I've discovered that the backend edit profile automatically generates a nonce that is placed as a hidden input in the form (id/name = '_wpnonce'). Because my form doesn't generate the nonce, submitting my form results in "Are you sure you want to do this? Please try again". How can I generate the nonce in my form?
I've tried using PHP in the Page (see technical notes) to generate the nonce. An example attempt was
[php]echo wp_nonce_field('update-user_' . $user_id)[/php], but it returns nothing. Is there a way to generate the nonce in my Page without building a plugin to create my form?
- Using the plugin "Register plus Redux" to create custom user fields. The plugin adds the fields to the backend edit profile.
- Using plugins "User meta shortcodes" and "Get User Custom Field Values" to populate the form with the users current profile settings.
- Using plugin "Allow PHP in Posts and Pages" to include PHP directly in Pages (through a [php][/php] shortcode)