0

Wordpress Version 4.9.9

I am develoing a demo plugin. For now it's quite simple, I am testing a 'wp_login' action hook.

The below part of my-plugin-log-init.php is not working as I want it to:

<?php


    add_action('wp_login', 'my_func');

    function my_func($username) {
    global $wpdb;


    $wpdb->insert(
        "{$wpdb->prefix}myfunc_log",
        array(
            "username"  => $username,
            "time"      => current_time('mysql')
        )
    );
}

I upload plugin in Network admin, then do the "network activate" to enable it on all sites.

Sadly usernames+timestamps are not recorded in mysql database. The ONLY activity recorded is when a person logs in /wp-admin/network (accesses here: site/wp-admin/network/wp-login.php)

None of multisites frontends accesses are recorded. Even /wp-admin accesses are not recorded

I tried different things. I disabled plugin. Uploaded it again in Network admin. ONLY activated it for one site (to test if it then works for this site). No. Result is still the same.

What the problem may be? any solution?

When I test it on a single simple wordpress site (not multisite with a network admin option), everything works as expected

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.