WordPress.org

Support

Support » How-To and Troubleshooting » Loading Custom JQuery code on the WordPress Login Page (wp-login.php)

Loading Custom JQuery code on the WordPress Login Page (wp-login.php)

  • Does anyone know why my custom Jquery code isn’t working on the wp-login.php page. Alls I need is a few simple lines of code, but it doesn’t seem to load when I try to execute it. Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You don’t provide a link to your site or show the code you’re using, so there’s no way to give you a specific suggestion.

    You might try using Firefox with the Firebug extension. It’s great for debugging javascript. You may just have a simple error in the JQuery you added that’s preventing it from running; Firebug will tell you where to look.

    It looks like it conflicts with other plugins etc. and has to be set up to add your own custom coding, but I found a JQuery noConflict Wrapper that can be placed around some of your code to wrork:

    jQuery(document).ready(function($) {
        // $() will work as an alias for jQuery() inside of this function
    });

    Just a note, it doesn’t look like jQuery is actually loaded on the log in page.

    Force jQuery to be loaded on the log in page:

    add_action( 'login_enqueue_scripts', 'custom_login_enqueue_scripts' );
    function custom_login_enqueue_scripts()
    {
    	wp_enqueue_script('jquery');
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loading Custom JQuery code on the WordPress Login Page (wp-login.php)’ is closed to new replies.
Skip to toolbar