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 to save the state of a drag and drop jQuery UI Sortables front end layout editor?
- How do I make script load after jquery?
- Using jQuery to delete data stored in wp_options
- 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
- Make jQuery library load before plugin files
- How to control what jQuery version to include, with wp_enqueue_script
- Adding jquery and thickbox to WordPress theme
- Move WordPress native javascript to bottom of page?
- Best Practices for Seperating jQuery from HTML/PHP
- RequireJS in custom theme. Working Example
- How to get a jQuery script to run on a page?
- Add `datetimepicker` to form
- Deregister WordPress jquery on specific page
- Fire jQuery function when post edit screen loads
- 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
- wp_enqueuescript won’t load in footer even with true value set?
- How wp_enqueue_script works?
- Enqueue jQuery in WordPress
- WordPress Script Loading/Unloading — wp_deregister_script(‘jquery’)
- How do I activate jQuery/script on demand?
- Adding jQuery dependency prevents my script from enqueuing/loading
- 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?
- Can’t move jQuery to footer
- 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
- Enqueuing javascript files
- WordPress loads Jquery Automatically – is my idea correct to add it to the footer?
- enqueued script with jquery dependency not getting jquery
- Creating multiple enclosing shortcodes and fixing JS issues on click
- Enqueue Google CDN jQuery in Footer
- How to undo deregister script and use local versions?
- ‘jQuery is not defined Error’ appearing in load-scripts.php
- Best way to include jQuery and fire with script at bottom of container
- Is it necessary to enqueue jquery?
- WordPress Ajax problem with undefined url
- Enqueue WordPress jQuery after it’s been deregistered by a plugin
- Move jQuery to the bottom of the page whilst keeping the WordPress jQuery
- Exclude some scripts from removing unique scripts from head function
- WordPress jquery files not being enqueued
- Searching multiple tags and adding jQuery dependant script onto page template?
- Why does javascript works only if logged in?
- Add/remove action on jQuery toggle
- Retrieve post info within AJAX helper function
- How to enqueue jquery in admin and why is it not already there?
- Enque Javascript in Footer?
- Plugins loading multiple copies of JQuery
- Why is my WordPress loading old version of JQuery?
- jQuery does not work
- Cannot enqueue jQuery correctly using Google CDN
- wp_enqueue doesn’t work
- Yoast SEO breaking media upload
- $.browser Undefined Seemingly Causing Faulty Page Display
- 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
- Why should I deregister jquery?
- Prevent other versions of jquery from loading on static front page
- 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 scripts on a single page plants the script in the footer
- registering new jQuery after wp_deregister_script() not working
- Loading a newer version of jQuery within WordPress
- Run JS function when JQ enqueued
- jQuery will not work on page from snippet or file
- Adding JavaScript file in Admin Panel
- Can’t delete the default jQuery in the theme
- jQuery plugin not loading
- 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?
- jQuery is not defined, working on local server but not online
- Using WP functions inside javascript