Take the 2-minute tour ×

I am getting two types of errors that I don't know how to fix.

You can see the errors here: http://www.brainbuzzmedia.com/themes/vertex/

The first type occurs twice and looks like this:

Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/admin/buzz/themes/vertex/wp-includes/functions.php on line 3587

I have a call in functions.php:

function my_init() {
if (!is_admin()) {
add_action('init', 'my_init');

The second error type is this:

Notice: Undefined property: stdClass::$slider_height in /vertex/wp-content/themes/vertex/slider_settings.php on line 32

No matter where (inside or outside of if statements or both) I define these variables they are still giving me this error.

* update

I have some other scripts enqueued in a subfolder of the theme's files, mostly used for admin area.

$path = get_template_directory_uri() . '/includes/metabox/smart_meta_box/smart_meta_fields/layout-editor/';

wp_enqueue_script('mcolorpicker', $path . 'js/mColorPicker.js', array('jquery'));

wp_enqueue_style('chosen', $path . 'css/chosen.css');

wp_enqueue_style('content-layout', $path . 'css/content-layout.css');

wp_enqueue_script('jquery-json', $path . 'js/jquery.json.js', array('jquery'));

wp_enqueue_script('chosen-jquery', $path . 'js/chosen.jquery.min.js', array('jquery'));

wp_enqueue_script('content-layout-js', $path . 'js/content-layout.js', array('jquery', 'jquery-ui-sortable'));

I think they may also be needed for front end display as well. How would I enqueue these the right way?

  • update 2

Here is the code where two of the undefined property errors occur:

link to txt

share|improve this question
Any ideas on this? –  BRAINBUZZ media Jul 5 '12 at 1:22
About the second problem, can you attach the relevant lines from your theme's files? –  yoavmatchulsky Jul 5 '12 at 2:49
added a link to the php file just in a txt –  BRAINBUZZ media Jul 5 '12 at 3:01

1 Answer 1

up vote 2 down vote accepted

Use the wp_enqueue_scripts action to call this function, or admin_enqueue_scripts to call it on the admin side.

To load it for front end, use

add_action('wp_enqueue_scripts', 'my_scripts_method');
function my_scripts_method() {

To load it for admin, use

add_action('admin_enqueue_scripts', 'my_admin_scripts_method');
function my_admin_scripts_method() {

Reference: Codex.

The second error occured because jQuery is not loaded.


If you hae any wp_register_script(xxx)orwp_enqueue_style(xxx)call in yourfunctions.php or in your any plugin file directly then use them inside wp_enqueue_script handler as follows

add_action('wp_enqueue_scripts', 'my_scripts_method');
function my_scripts_method() {
    wp_register_script('xxx'); // replace the xxx with valid script name
    wp_enqueue_style(xxx) // if you have any
share|improve this answer
I've replaced my "my_init" code with your front end and admin actions but I am still getting the same error. Why is it saying the error is in "/wp-includes/functions.php"? I haven't touched anything in the wp-includes folder. Also, how is the second error from jquery not being loaded? It is loaded in the header through that script. –  BRAINBUZZ media Jul 5 '12 at 1:50
What is on line line 3587? –  The Alpha Jul 5 '12 at 1:55
My wp-includes/functions.php is the same as the one you can download from wordpress.org. I can't tell what is actually on line 3587 because there are commented areas but nothing is related to enqueue. Nothing even shows up if I search the file for enqueue. My functions.php in the theme's folder isn't even close to that many lines long. –  BRAINBUZZ media Jul 5 '12 at 2:05
Do you have any wp_register_script call inside your theme's functions.php ? –  The Alpha Jul 5 '12 at 2:13
Check the update. –  The Alpha Jul 5 '12 at 2:23

Your Answer


