Custom Front End Registration – How Does the Key work in the Password Set Request?

Because I couldn’t find an answer on this, I handled it myself by setting my own cookie in the function and checking that. Here is the revised function: function custom_login_init () { $action = isset($_REQUEST[‘action’]) ? $_REQUEST[‘action’] : ‘login’; if ( isset( $_POST[‘wp-submit’] ) ) { $action = ‘post-data’; } else if ( isset( $_GET[‘reauth’] … Read more

Register form: add custom field BEFORE default fields

You can’t, because of wp-login.php structure. Here is code with register_form hook: <form name=”registerform” id=”registerform” action=”<?php echo esc_url( site_url( ‘wp-login.php?action=register’, ‘login_post’ ) ); ?>” method=”post” novalidate=”novalidate”> <p> <label for=”user_login”><?php _e(‘Username’) ?><br /> <input type=”text” name=”user_login” id=”user_login” class=”input” value=”<?php echo esc_attr(wp_unslash($user_login)); ?>” size=”20″ /></label> </p> <p> <label for=”user_email”><?php _e(‘Email’) ?><br /> <input type=”email” name=”user_email” id=”user_email” class=”input” … Read more

Redirect in form handler causing form to be submitted twice

You can fix it through Session. try function vv_process_profile_forms() { session_start(); if ( isset( $_POST[‘action’] ) && $_POST[‘action’] == ‘profile-form’ ) { if ( ! isset( $_SESSION[‘form-submit’] ) ) { // form processing code here $_SESSION[‘form-submit’] = 1; $redirect_page = get_permalink( 586 ); wp_redirect( $redirect_page ); exit; } else { unset( $_SESSION[‘form-submit’] ); } } … Read more

Hook when editing user

Yes, this is CORRECT add_action(‘edit_user_profile’, ‘limpiamosVariables’); function limpiamosVariables($user){ // My Code Sample update_option( “var_ios_token”, get_field(‘token_user’, ‘user_’.$user->id) ); };

When are wp redirect methods safe to hook?

I’ve been going through action hooks and the earliest I’ve gotten it to work properly with my conditions for user and page type conditions is the wp action. Although, I am currently hooking it into template_redirect as it seems most appropriate and intended for this purpose according to the codex: It is a good hook … Read more

Adding a hook to the default (page.php) template

if you want modify the content, there is the filter the_content. if you want to intercept the template file before it is included : filter template_include to catch a shortcode (like Visual Composer e.g.) : filter do_shortcode_tag and the filter vc_shortcode_output for only the shortcodes of Visual Composer