Action when you log WordPress

0

I need to know when the user logs in to verify if they have empty billing information. If not, I will redirect you to the page to fill them out. The fact is that wp_login does not work for me, I do not know why.

function datos_facturacion_user(){
    $user_id = get_current_user_id();
    $meta = get_user_meta($user_id);

    // Campos de facturación
    $nombre = $meta['billing_first_name'][0];
    $direccion = $meta['billing_address_1'][0];

    // Verificar si están vacíos
    if(empty($nombre) || empty($direccion)){

    }

    echo "<script>alert('" . $nombre . " " . $direccion . "')</script>";
}
add_action('wp_login', 'datos_facturacion_user');
    
asked by Csc99 23.10.2018 в 15:50
source

0 answers