jquery wp_enqueue script
-
Hi there, i just found that your plugin shows a warning.
Aparently you enqueue jquery script not following the WordPress recomendations, and thats creates a warning message if someone remove std jquery script and add a new version in the function.php on every theme.
I found this making a traceback to see witch plugin was generating this warning.
Description of the warning
Unknown wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) on line 3012
This warning i found with Blackbox plugin.
I paste here the code of the traceback function that i paste into wp-includes/function.php to find what file and function were generation this issue.
function GetCallingMethodName($g){ $e = new Exception(); $trace = $e->getTrace(); //position 0 would be the line that called this function so we ignore it $last_call = $trace[2]; <- i set 2 because 0 is the function GetCalling... 1 is the function that shows the msg and 2 is the one who origin the problem. print_r($last_call); print("<br>"); }
Put that function wherever into wp-includes/function.php and then paste this code just after line 3012
if(is_admin()) GetCallingMethodName("");
This is happening to me because in my theme i do this:
function an_load_custom_wp_scripts() { wp_deregister_script('jquery'); wp_register_script('jquery', get_template_directory_uri().'/js/jquery.min.js', false, '1.10.2', false); wp_enqueue_script('jquery'); } add_action('wp_enqueue_scripts', 'an_load_custom_wp_scripts',20);
- The topic ‘jquery wp_enqueue script’ is closed to new replies.