Skip to content

Instantly share code, notes, and snippets.

@trepmal
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trepmal/11011808 to your computer and use it in GitHub Desktop.
Save trepmal/11011808 to your computer and use it in GitHub Desktop.
<?php
// script on registration page only
// limited testing
// can go in path/to/wp/wp-content/mu-plugins/
add_action( 'login_enqueue_scripts', function() {
if ( isset( $_REQUEST['action'] ) && 'register' == $_REQUEST['action'] ) {
// script here
// echo '<script...></script>';
// or
// wp_enqueue_script( 'script-handle', 'script-url.js' );
// see http://codex.wordpress.org/Function_Reference/wp_enqueue_script for params
}
} );
@trepmal
Copy link
Author

trepmal commented Apr 17, 2014

or without the closure...

add_action( 'login_enqueue_scripts', 'yourprefix_login_enqueue_scripts' );

function yourprefix_login_enqueue_scripts() {

    if ( isset( $_REQUEST['action'] ) && 'register' == $_REQUEST['action'] ) {
        // script here
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment