Tag Info

Hot answers tagged

3

When you pour some water into a glass, first you put the glass on the table, then you turn the bottle. If you first turn the bottle, and then put glass on the table, your floor gets wet and your glass stay empty. Actually wp_enqueue_scripts is just a way to save a variable (water) inside a global object (glass), so before to call the function (turn the ...


2

You should first load your scripts with a hook on wp_enqueue_scripts like this for example : add_action( 'wp_enqueue_scripts', 'load_my_scripts' ); function load_my_scripts() { wp_enqueue_script( 'jquery' ); } What I like to do is, register my script with a hook on init and then enqueue them with a hook on wp_enqueue_scripts: // Register Scripts ...


2

Scripts and stylesheets should always be loaded in the head or in the footer via the wp_enqueue_scripts action hook. wp_enqueue_scripts is the proper hook to use when enqueuing items that are meant to appear on the front end The init hook executes before wp_head which is to early for script to load in the header. The wp_enqueue_scripts action hook is ...


2

I would use jquery-masonry included in Wordpress core: function my_scripts() { wp_enqueue_script( 'jquery-masonry', true ); } add_action( 'wp_enqueue_scripts', 'my_scripts' ); If you really need the standalone masonry library, you should use your "first way" but I would not use "my_masonry" as handle for the script, I would use "masonry" if you have ...


1

Do you have the "all-in-one-wp-security-and-firewall" plugin? More info: https://wordpress.org/support/topic/load-scriptphp-fails-to-load?replies=3 Short answer, if so, disable the "Deny Bad Query Strings" option. If not, check for any other "security" plugins you have that might be doing dumb things.



Only top voted, non community-wiki answers of a minimum length are eligible