Robert Saylor
asked on
Notice: wp_enqueue_style was called incorrectly
Stylesheet in WordPress plugin:
When this is ran I get a notice warning:
Notice: wp_enqueue_style 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.0.) in /home/username/public_html /wp/wp-inc ludes/func tions.php on line 4147
I have spent several hours on google trying different combos but it keeps falling back to this warning.
Note: I am looking for a solution in the plugin folder only. I do not want to mess with the theme. I have another same issue with a script and solving this will also solve another problem I have.
$plugin_dir = "test";
wp_enqueue_style('style', plugins_url("/" . $plugin_dir . "/css/style.css"), array(), null, null);
When this is ran I get a notice warning:
Notice: wp_enqueue_style 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.0.) in /home/username/public_html
I have spent several hours on google trying different combos but it keeps falling back to this warning.
Note: I am looking for a solution in the plugin folder only. I do not want to mess with the theme. I have another same issue with a script and solving this will also solve another problem I have.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER