How to include a JS file in this theme?

From wp_enqueue_scripts action: wp_enqueue_scripts is the proper hook to use when enqueuing items that are meant to appear on the front end. For admin-facing scripts, the correct action hook is admin_enqueue_scripts function prefix_enqueue_scripts3() { wp_enqueue_script( ‘metabox_js’, get_stylesheet_directory_uri() . ‘/js/metabox.js’, array( ‘jquery’ ), ‘1.0.0’, true ); } add_action( ‘admin_enqueue_scripts’, ‘prefix_enqueue_scripts3’ );

How can I remove the site URL from enqueued scripts and styles?

Similar to Wyck’s answer, but using str_replace instead of regex. script_loader_src and style_loader_src are the hooks you want. <?php add_filter( ‘script_loader_src’, ‘wpse47206_src’ ); add_filter( ‘style_loader_src’, ‘wpse47206_src’ ); function wpse47206_src( $url ) { if( is_admin() ) return $url; return str_replace( site_url(), ”, $url ); } You could also start the script/style URLs with a double slash … Read more