I wrote a pretty basic plugin and I’ve tested it a local site (running through MAMP) and on a live site. When I install the plugin on the actual site I’m using it on the script intended for the user side doesn’t doesn’t get loaded. All the backend code used in wp-admin works fine but the user js file doesn’t even load on the site. However, it does on others:

add_action("wp_enqueue_scripts", "headerPromoTxt_user_scripts");
    function headerPromoTxt_user_scripts(){
        wp_register_script('headerPromoTxt_user',plugins_url('../js/header-promo-txt-user.js', __FILE__ ),array('jquery'),'',true);
        wp_localize_script('headerPromoTxt_user', 'myAjax', array('ajaxurl'=>admin_url('admin-ajax.php')));

I’ve turned on debugging and I don’t get any errors for the code. I’ve also just tried doing an echo "test" to see if the function is even ran and I get nothing. It’s almost like the theme is ignoring the wp_enqueue_scripts action.

Read more here: Why won’t wp_enqueue_scripts work on one site but it will another?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, ,

Wordpress related questions and answers: