skip to Main Content

How to add a simple jQuery script to WordPress?

How to add jQuery script or other javascript code to WordPress footer, such as google tracking code?

Open your theme’s functions.php file, add the following code

add_action( 'wp_footer', 'custom_add_script' );
function custom_add_script() {
    echo '<script>
	jQuery(document).ready(function( $ ){
		//Your jQuery script here
	});
	</script>';
}

Leave a Reply

Back To Top