bundled jquery in theme js not working with wp_localize_script

You can’t use wp_localize_script with jquery. this function use the WP_Scripts::localize() function which have a condition right in the start. You can see it in the file \wp-includes\class.wp-scripts.php line 414 if ( $handle === ‘jquery’ ) $handle=”jquery-core”; You can do something else like add the script with other action like wp_head if your script is … Read more

I can’t load my images from a js file using wp_localize_script

You’re not accessing the value correctly. The 2nd argument of wp_localize_script is the name of a JavaScript object that your data will be added to. In your case it’s wpa_data. This means that the image_path is accessed at wpa_data.image_path: $(function(){ jQuery(document).ready(function() { $(‘#home’).backstretch([ wpa_data.image_path+”home-bg-slideshow1.jpg”, wpa_data.image_path+”home-bg-slideshow2.jpg”, wpa_data.image_path+”home-bg-slideshow3.jpg”, ], {duration: 2000, fade: 750}); }); })

Issue with wp_localize_script

You should remove trailing slash / from 3rd line. $ait_pfad = plugin_dir_url( __FILE__ ) . ‘/assets/js/ait_buttons.js’; this should be $ait_pfad = plugin_dir_url( __FILE__ ) . ‘assets/js/ait_buttons.js’; wp_plugin_dir() function returns url including a trailing slash (“https://wordpress.stackexchange.com/”) so you should not add it again. Please read wp_plugin_dir() function reference to learn more about this function.

Ajax is not defined

jQuery is not defined because you’ve not referred jQuery as dependency for your script so wp isn’t aware it should load it for your script. wp_localize_script should be called on script that is already linked via wp_enqueue_script, so you first run wp_enqueue_script then wp_localize_script as you do in your UPD. Another thing about wp_localize_script is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)