Find answers, ask questions, and connect with our
community around the world.

Forums Forums Web Design WordPress Run function when Admin logs in

  • Run function when Admin logs in

    updated 1 year, 1 month ago 0 Member · 1 Post
  • SharonP

    Member
    August 28, 2021 at 5:08 pm

    function send_admin_email_on_login(){ if ( current_user_can( ‘manage_options’ ) ) { $ip = $_SERVER[‘REMOTE_ADDR’]; $send_to = ‘test@example.com’; $subject = ‘New admin login’; $message = “A new login from” . $ip . “”; wp_mail( $send_to, $subject, $message ); echo ’email sent’; } else{ echo ’email not sent’; } } add_action(‘wp_login’, ‘send_admin_email_on_login’, 10, 3); Can anyone see why this function isn’t firing when a admin logs in? – by /hq/artFlix – –

Viewing 1 of 1 replies
Reply to: SharonP
Your information:

Cancel
Original Post
0 of 0 posts June 2018
Now