• I’ve created a simple Code Snippet to test the upgrader_process_complete hook. I cannot get it to trigger on plugin updates or plugin activation. I see no errors with wp_debug true.

    function log_this($upgrader_object, $options) {
    error_log(‘upgrader_process_complete triggered!’);
    }
    add_action(‘upgrader_process_complete’, ‘log_this’, 20, 2);

    I’m using a new very basic WordPress installation with only Code Snippets and Elementor plugin with the Hello theme. Any ideas on troubleshooting? I also tried it with child theme in functions.php.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ronr1999

    (@ronr1999)

    Solved… sort of. I found that if I turn on define( ‘WP_DEBUG_LOG’, true ) then I get these error_log entries sent to ( wp-content/debug.log ). I can use this but why weren’t they going to the error_log file?

    Moderator bcworkz

    (@bcworkz)

    I’m not sure what updates you were testing with, but ‘upgrader_process_complete’ only fires for singular updates. It does not fire with bulk updates. The do_action call is within a if ( ! $options['is_multi'] ) conditional. Probably because with bulk updates it would fire multiple times which is illogical.

    It’s possible the bulk handler unsets ‘is_multi’ for the last update, causing the action to still fire once. Or maybe it doesn’t, IDK. This may or may not be an explanation for the behavior you observe. If not, I’ve no other thoughts, sorry.

    Thread Starter ronr1999

    (@ronr1999)

    Actually it was working but just not adding to error_log file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘On plugin updates – upgrader_process_complete hook will not trigger?’ is closed to new replies.