Provided you’ve confirmed that WP’s native ‘suggest’ script is actually being rendered on the page properly (ie. you’re using the correct template for home vs front-page), sometimes to avoid script conflicts on the page, you need to wrap your script in an anonymous function. So something like:
<script>
(function($) {
$("#my_input").suggest("<?php echo get_bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=my_taxonomy", {
multiple: true,
multipleSep: ","
});
})(jQuery)
</script>
Ideally, this should also be separated off into its own .js file and registered/enqueued properly on the wp_enqueue_scripts
hook with ‘suggest’ declared as a dependency:
wp_enqueue_script( 'my-suggest', 'path/to/my-suggest.js', array( 'suggest' ), false, true );
Related Posts:
- wp_enqueue_scripts hook is not being called
- Plugin Scripts no loading on options page
- Fire action after enqueue script
- Enqueue core jQuery in the footer?
- How to correctly include jquery-ui effects on wordpress
- How do I make script load after jquery?
- Correct Method to run scripts with dependencies without enqueue?
- Concatenate and minify dependencies for enqueued JavaScript files
- tinymce is not defined when not using wp_editor
- WordPress AJAX File Upload – FrontEnd
- How to control what jQuery version to include, with wp_enqueue_script
- Adding jquery and thickbox to WordPress theme
- Best Practices for Seperating jQuery from HTML/PHP
- How to get a jQuery script to run on a page?
- Gravity Forms loading jquery
- Moving jQuery to the footer without using de-register in WordPress
- Including javascript for a shortcode
- Asynchronous Javascript Loaders
- Best Way to Include Scripts on a Specific Template Page
- ajax call in wordpress front end
- How to include jquery validate in a template
- wp_enqueue_script won’t load in header?
- chosen jquery library not loading – is not a function error
- wp_enqueue_script and wp_register_script in theme not working
- Enqueue jQuery in WordPress
- WordPress Script Loading/Unloading — wp_deregister_script(‘jquery’)
- How do I activate jQuery/script on demand?
- How do I get my page to load the jQuery UI Effects library?
- jQuery on Underscores menu
- Simple jQuery Click Not Working, though console log recognizes the function [closed]
- Script won’t execute in the media manager
- When does WordPress automatically enqueue jQuery?
- How to properly add Bootstrap and JQuery Javascripts?
- Using multiple versions of jQuery while still calling it like WP likes
- wp_ajax() question.. not using wp_enqueue_script?
- Why isn’t jQuery 2.1 loading in the header?
- Override default jquery ui library with newer version
- enqueue the scripts
- WordPress loads Jquery Automatically – is my idea correct to add it to the footer?
- Enqueue Google CDN jQuery in Footer
- ‘jQuery is not defined Error’ appearing in load-scripts.php
- Best way to include jQuery and fire with script at bottom of container
- Enqueue WordPress jQuery after it’s been deregistered by a plugin
- Exclude some scripts from removing unique scripts from head function
- WordPress jquery files not being enqueued
- Why does javascript works only if logged in?
- How to enqueue jquery in admin and why is it not already there?
- Enque Javascript in Footer?
- Plugins loading multiple copies of JQuery
- jQuery does not work
- Cannot enqueue jQuery correctly using Google CDN
- Yoast SEO breaking media upload
- Unexpected script loading order
- Problem getting .js file to load via a plugin
- Using jquery-1.7.2.min.js instead of the wordpress jquery
- How register library to use jquery correct
- WordPress error when replacing local jQuery by externally-hosted
- Trouble enqueueing jquery with custom theme
- change order of add_action hooks for jquery to be loaded first
- How to enque js script in footer that are not in .js file?
- Loading a newer version of jQuery within WordPress
- Run JS function when JQ enqueued
- Adding JavaScript file in Admin Panel
- Can’t delete the default jQuery in the theme
- Enqueue script: link not working in page source
- Can’t execute jQuery before my script
- Why does deregistering jQuery cause other scripts not to load?
- Using WP functions inside javascript
- Including Older Version of jQuery for IE7/IE8
- Assigning tags to a post from front end using tag-it jquery UI plugin
- How To Include JavaScript Files Only In Single Posts?
- Which hook to use when adding ajax to viewer-facing side?
- Calling multiple scripts using wp_enqueue_script
- Bootstrap and jQuery error: $ is not defined
- Override parent theme deregister
- How to make JQuery load on top of head tag before everything
- Uncaught ReferenceError: jQuery is not defined
- jQuery Plugin Uncaught TypeError: jQuery(…).slider is not a function
- JavaScript code do not works on online server
- True parameter but jquery register in header and not in the footer with wp_register_script
- Bootstrap with separate js File
- Move jQuery on *top* of footer
- File not enqueueing
- Enqueue script, taking no effect [closed]
- WordPress and Raty.js
- How to add JS snippet before closing tag?
- Enqueue javascript that inserts custom php widget into jQuery-constructed div
- jQuery AJAX add json2 dependency?
- Scripts only working on home page
- Object [object Object] has no method ‘slides’
- JS plugin script loading but not working
- Need help with adding jQuery script to WP and calling script to page
- How to Run a jQuery Script after a Javascript Script has Finished in WordPress
- Monarch JS has not been loaded. After changing the $dep parameter, it start being loaded
- jQuery issue and wp_enqueue_script
- bootstrap-slider.js by seiyria not working in wordpress
- Dynamically populate Cascading Dropdown from MySQL using JQuery/AJAX [closed]
- How to enqueue script before jQuery? [duplicate]
- javascript and css not loading properly in WordPress site
- Making the Google Maps API non readable