jQuery not working when used with wordpress menu

You are missing <script> tags You are using the wrong jQuery variable name. If you want to use the $ alias you need to use noConflict as helgatheviking suggested or switch to “jQuery” instead of $ You are missing }); at the end of the code you posted above You should consider separating your JS … Read more

Adding instant search to wordpress page

I finally figured this out. What ended up working is putting the script portion in a .js file within the theme directory, calling it using the functions.php in my child theme, and having the HTML input field and div tag in the body of the page. Hopefully this can spare others the same pain I … Read more

No Authors for custom post type

You need to include the post type in the pre_get_post filter: (Not sure about global $user_ID;, just reproduce that part of your code) function content_for_current_author($query) { if($query->is_admin) { global $user_ID; $query->set(‘author’, $user_ID); $query->set( ‘post_type’, array(‘acf’, ‘another-custom-pot’, ‘page’, ‘post’) ); } return $query; } add_filter(‘pre_get_posts’, ‘content_for_current_author’); Details in WP Query documentation for Type Parameter Also, your … Read more

How to deregister scripts all at once

Its already answered on this link <?php //To remove all script from the page function remove_all_scripts() { global $wp_scripts; $wp_scripts->queue = array(); } // to remove all stylesheet add_action(‘wp_print_scripts’, ‘remove_all_scripts’, 100); function remove_all_styles() { global $wp_styles; $wp_styles->queue = array(); } add_action(‘wp_print_styles’, ‘remove_all_styles’, 100); ?> It will remove all the scripts enqueued by standard method. Manual … Read more

Script work on non logged in user but not work for logged in user?

i finally know why this code not work. as menstioned by Jorn Lund in the comment that jQuery(document).ready() will fail when script loaded async ( i still dont know is my code load async) but with in mind i change from jQuery(document).ready() to self execution function (function($){ alert(“hello”); })(jQuery); and the code work very well … Read more