Last active
April 11, 2023 12:09
-
-
Save Nekaravaev/041b126ffb905422c5524bc611fe4ec4 to your computer and use it in GitHub Desktop.
[wordpress] Debug switch_to_blog snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\add_action('switch_blog', function ($new_blog_id, $prev_blog_id, $context) { | |
error_log("Switch! {$prev_blog_id} -> {$new_blog_id}. Context: {$context}"); | |
if (count($GLOBALS['_wp_switched_stack']) > 1) { | |
error_log('Catch anomaly with _wp_switched_stack!'); | |
$e = new \Exception; | |
error_log($e->getTraceAsString())); | |
} | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment