Usually scripts and styles are loaded with wp_enqueue_script
or wp_enqueue_style
in the theme’s functions.php
. That’s the most common scenario.
This function takes an $src
parameter which is the absolute URL to the resource, and the best practice is to use get_stylesheet_directory_uri
to retrieve the URL to the folder containing the script. This way, if the site is moved, the URL will change with it.
It might be that those were hardcoded strings. That’s why they’re still the old ones.
See examples below
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#user-contributed-notes
Scripts and styles loaded from a plugin should use plugins_url
in the $src parameter.
wp_enqueue_style( 'prm_style', plugins_url('/assets/style.css', __FILE__ ) );
Related Posts:
- Disable plugin / plugin action via theme
- Where can I sell WordPress themes and plugins? [closed]
- What are the package and subpackage comment for?
- Experiences with adding Nonces to the comment form
- How to add plugins to wordpress theme?
- Need to create a Theme demo site that features multiple themes
- Get URL of a specific file
- How do I make my wordpress page more friendly for mobile viewers?
- disable active plugins for specific theme
- Check javascript file Proper way in functions.php
- Should I use RIPS tool to test my themes and plugins?
- Make the css of the widget overwrite theme css
- A way to sort WordPress themes? [closed]
- adding a text message beside the comment submit button
- Recommendations for books/resource to get started with wordpress 3 development (plugins/themes) [closed]
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin
- Why are some of my thumbnails not being generated?
- How to Implement “Notice: This theme recommands the following plugin:xyz” in wordpress? [closed]
- Making menu link open in new tab?
- Change settings of get_post_type_object
- Sage WordPress – Plugin Namespace: Not Found
- How to Know if a Plugin can be used with my Theme [closed]
- Not able to open category post [closed]
- Reusable functions and tools (Framework)
- Only Homepage not loading properly
- Using custom JS plugins with WordPress?
- plugin style conflicts, how to override? [closed]
- Globally register styles but enqueue them selectively
- Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes
- Admin Theme customization
- (FES EDD) New vendor submission page is blank
- There is any way to remove post-format filter? [closed]
- WordPress site periodically goes down
- Masonry images not working
- (Big issue) Blog is Getting Down Each day.. what should i do.?
- Custom wordpress Theme and Plugin repository
- How to require users to login when not logged in
- Error when using plugin QuickCache with plugin Mobile Smart ? [closed]
- How do I find out what is in control over a certain part of a website?
- How do I combine a theme with a plugin
- Overwrite category head title
- Create a single website with 3 theme options in wordpress
- Create custom pages with a plugin
- Does heavy theme and plugins affect server’s response time? [closed]
- Proper way to use plugin functions in functions.php
- Use different single.php file based on condition
- how remove font to increase site speed load
- Use $variable from file1.php in file2.php (different file paths)
- What is the purpose of WP_CONTENT_URL?
- issue in wp_localize_script
- How can I use my custom wordpress theme on two websites? [closed]
- How to remove products-links after the product title using remove_action
- Can I filter a function created by a theme or a plugin?
- How I update WordPress theme and plugins
- Overwrite add_image_size defined by theme
- Don’t load the theme for a page FROM a plugin EDITED
- Detect plugin/theme installation (via upload)
- How to check homepage contain blog post?
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- is there a way to pass a parameter to a add_menu_page function?
- plugin inside a wordpress theme
- Share plugins, themes, and multi post in a multidomain network
- Removing the custom_image_header from wp_head
- Gantry Framework: new page loads homepage content instead of page content
- Upgrade not working & themes not supporting
- Plugin Admin panel checkbox unchecked after submit
- use EDD Content Restriction for restricting php in template
- admin-ajax.php 500 error when new users try to register
- Elementor Sidebar not loading when PRO elements plugin is active
- Elementor pro page editing gives error There has been a critical error on this website. Please check your site admin email inbox for instructions
- how to display a template.php in a shortcode
- Removing Plugin Action via Theme for Non-admins
- Fatal error: Class ‘RDTheme’ not found
- How to fix blog article view and share #’s?
- When the user entered an unauthorized url redirect to login page
- how to add navigation icons in specific template?
- I want add repository theme folder
- How to make a website with two types of logins , Sellers and buyers?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- Why all my wordpress sites keeps telling me that everything is up to date at /wp-admin/update-core.php?
- How can I save cookies to members
- How to add separator between default and custom panels in WordPress customizer?
- Speed issues because of CSS & JavaScript
- Ajax specific template not loading in replacement of index.php
- Woocommerce: deleted single-product.php, everything still works. How is it possible?
- pluggable function in theme, to be overridden by plugin
- How to tell if a script is being executed from a plugin, a theme or a child theme in WordPress?
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- How can I modify the colors of my theme for a single section of my site? [closed]
- How to work email subscribe in WordPress?
- how to change location of the plugins & wordpress themes folder
- How to add a plugin in WordPress theme directory?
- Extra Text in Home URL
- WP Customer Reviews call short code on another page [closed]
- Editing a theme
- Self-hosted Plugins & Themes store with auto-updates? [closed]
- Am having issues intergrating this api into my wordpress site, any help please?
- How to make content as required in custom post type?
- How to add links to different language versions of WordPress
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)