I have a plugin page, which doesn't have header.php or footer.php. How can I include Wordpress jQuery on this page so I can use syntax like below ?


At the moment it says:

Uncaught ReferenceError: jQuery is not defined
  • Is the plugin page in admin area or in front end? Please provide a bit more details. – Vinod Dalvi May 18 '17 at 12:52
  • 1
    As @VinodDalvi said, this question lacks context. For example why exactly the page lacks calls to header.php – Mark Kaplun May 18 '17 at 13:57
  • 1
    looks like you are trying to define jquery.min.js, in the header.php of the theme or in the header/footer section when page loads so your script will run Right ? – Muhammad Abdullah May 18 '17 at 19:33

Though uncommon, you can use wp_print_scripts( ['jquery'] ) for explicit output.

Note that you might hit issues with hooks firing in unexpected ways and such. Generally all WP pages on front end should just implement header/footer properly.


Use wp_head(); and wp_footer(); if you're putting all html in just one file.

Although I would suggest making custom header for your plugin page. Which will have <head>, <html> and other necessary tags. Same with footer. eg. header-plugin.php and the use get_header('plugin');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.