v2.0 fixes “wp_get_current_user” in the worst way possible
-
What you did is basically this:
if (!function_exists('wp_get_current_user')) { require_once(ABSPATH . "wp-includes/pluggable.php"); }
– which works, but if there’s anything that tries to load it later, you’ll get a fatal on function redefinition.
A better way to fix the issue is to change this:
if (is_admin() or is_super_admin()) { // add_action('admin_enqueue_scripts', 'restore_classic_load_upsell'); add_action('wp_ajax_restore_install_plugin2', 'restore_install_plugin2'); add_action('wp_ajax_nopriv_restore_install_plugin2', 'restore_install_plugin2'); }
to this:
add_action('init', function(){if (is_admin() or is_super_admin()) { // add_action('admin_enqueue_scripts', 'restore_classic_load_upsell'); add_action('wp_ajax_restore_install_plugin2', 'restore_install_plugin2'); add_action('wp_ajax_nopriv_restore_install_plugin2', 'restore_install_plugin2'); }});
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘v2.0 fixes “wp_get_current_user” in the worst way possible’ is closed to new replies.