Shouldn’t you be enqueuing that in functions.php instead?
function script_enqueueing() {
wp_enqueue_script(
'scripts',
get_stylesheet_directory_uri() . '/js/scripts.js',
array('jquery')
);
}
add_action('wp_enqueue_scripts', 'script_enqueueing');
Edit to add: if calling directly in header.php, use get_template_directory_uri();
instead.
Related Posts:
- Prevent WordPress from interpreting a subfolder?
- How to fix: “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”
- How to recover WordPress Adress(URL)
- How can I block with a child theme certain pages?
- Install wordpress as a development site in a subdirectory on live server
- How to override JavaScript files in child theme?
- Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error
- How do I dequeue a parent theme’s CSS file?
- How to properly dequeue scripts and styles in child theme?
- WordPress Migration: Getting 404 Errors: Only Home Page works
- External page integrated into WordPress returns a 404 error
- WordPress Theme’s 404.php not found, server defaults to Apache’s own 404 page
- get_the_ID() gives notice in 404 page
- How to open the 404 page in the Theme Customizer preview?
- jquery script not enqueued in child theme
- Feed 404 Errors
- 404 when fetching image from wp-content/uploads/
- REST API: No route was found matching the URL and request method
- WordPress REST API 404
- Trying to load different syles for 404.php page
- Changing Site Address (URL) causes 404
- Detect 404 before headers are sent
- Unwanted redirect in admin area
- In wordpress I am manipulation 404 response. I want to give the response before 404 error is given to google
- Adding Custom Javascript to Skeleton Child Theme
- 404 error on homepage when using Nginx proxying to Apache
- Non “WordPress” pages/code getting 404 error
- 404 error on all pages but homepage
- Child Theme – what is the scope of overwriting files?
- Where is the best part to hijack or catch a potential 404
- How to dequeue / deregister parent theme style
- Why is there /index.php/ in all my links? How do I remove it?
- page not found in Chrome, but found in Firefox
- Enqueue styles properly in a child theme and stylesheets location
- Why does my WordPress show a 404 message for 403 forbidden directories?
- Moved to new server, all pages work EXCEPT home page (page not found)
- High CPU usage on 404 errors
- How to fix “failed to set referrer policy: The value ‘ ‘ is not one of…”?
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- Subfolder multisite issue. Themes and plugin files 404
- “Lost password” page triggers 404
- 404 to 301 – Fixing old links
- How do I bypass WordPress 404 handling?
- $error = 404 after caught add_rewrite_rule
- Loading files for theme and child theme (Require)
- Checking for page templates in child theme
- How do I go about fixing this apparently messed up upgrade?
- WordPress Stats keeps showing non-existent post as a top post?
- How do I get a child theme to load scripts from the parent theme?
- WP Rest API not working
- Is my child theme working properly
- WP .js script file not loading
- Components used in Themes and Plugins: How to get file URL?
- Including style.css in Child Theme
- What does do_action(‘admin_init’); does actually?
- Form in WordPress : 404
- Why is my Javascript console showing a 404 error for a file called “null” on a clean WordPress install?
- Why Runtime service worker (runtime-service-worker.js) is being loaded, but can’t be found?
- wp_add_inline_script not adding when script_loader_tag filtered
- Adding tawk.to code just before body tag on functions.php file
- Non-existent page returns code 200
- WP is redirecting instead of going to 404
- Conditional for 404 page not work
- Nginx with WordPress not showing template 404 for certain file types
- post parameter ‘name’ 404 error
- Including files in Child Themes
- Intermittently missing pages and posts in WordPress
- Getting a 404 in Debugger for example.com/wp-admin/Array?
- Fixing custom 404 pages broken by WordPress in a subdirectory
- Exclude JS file from 404 error page
- oEmbed 404 errors when trying to use embed block
- Intercept 404 and try to serve another content if exists?
- How to enqueue scripts in order of Head section
- Cannot dequeue script in child theme
- 404 after moving localhost wp to server
- Intermittent 404 errors, rewrite rules, and BBPress
- How do I show the WP admin error page?
- WordPress takes too long to show 404 error on images (on LEMP stack)
- How to create a child theme with multiple css files.
- WordPress Post – On Post – 404 Page Not Found
- How to find out which function is causing a 404
- Template redirect template loaded, but the header 404
- Getting 404s on New Pages
- How can I send an email in my plugin?
- All pages after level 1 showing 404 after WordPress migration plugin – how to fix?
- index2.php in root causing 404 error
- Why I get File Not Found (404 error) when the file is actual there?
- WP_DEBUG must be on, otherwise edit post or page will show 404 error
- How to integrate my HTML and javascript into my child theme
- Getting “404 page not found” error when i access to my Login page
- Virtual robots.txt missing
- Moved from Blogger to WordPress, however I can only see the Google 404 page
- Can´t access child theme´s scripts dependencies found in parent
- Custom 404 page for dashboard
- wp-tinymce.php 404
- WordPress.org support topics returning 404 [closed]
- Display child pages on parent page: 404 message overrules shortcode in page
- Installing plugins and using complex folder structure with child theme in WordPress
- Is it possible to make *.js and folders visible in theme-editor
- How can I prevent non-existing wordpress pages from getting redirected to home page