You can’t enqueue because wp_loaded
is too early.
To enqueue scripts and styles, you need to do it on the wp_enqueue_scripts
type hooks, but because your exiting on wp_loaded
, none of those hooks have fired yet.
Additionally, you need to have the necessary function calls in the template for it to enqueue them into, such as wp_head
or wp_footer
, otherwise there is no opportunity to generate the script and link tags
So your options are:
- use a later hook than
wp_loaded
that happens after the scripts have been enqueued - include the scripts manually inline
Related Posts:
- Using register_activation_hook in classes
- Custom plugin: Trying to show saved data on frontend
- How to set a custom path, for ajax image upload folder in admin?
- action hook wp_head higher priority as all other plugins/hooks
- How to call function at the bottom of post using plugin?
- Adding widgets to my plugin page instead of WordPress dashboard
- Adding function to Genesis genesis_header [closed]
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- using filter and hook inside class
- get Woocommerce product format json for WP_Query
- Register/enqueue scripts only on certain admin pages
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- Custom filter not affecting gtag script position in WordPress footer
- Add Imports to Existing WordPress Import Map
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- WP add_action factory
- WP nonce invalid
- woocommerce subscriptions – get expiration date [closed]
- Same log message keeps on printing to debug.log file thousand of times
- Handling Body class based on Template
- How to load a template-part based on a url wildcard?
- Adding Default Settings to Theme My Login plugin
- Custom filter in admin edit custom post type responding with invalid post type?
- WordPress Scheduled Event Request Blocking
- How can i upload images in an admin page?
- Append HTML Using Shortcode
- Delete a WordPress transient from a shortcode on Page/Post update
- Remove an action hook within a Class
- Plugin CSS not enqueing
- Create onClick Event to Re-load a Widget
- Swapping wp_dropdown_categories function with wp_category_checklist
- Accessing the database from a plugin outside of action hooks
- How to pass arguments to add_action() or retrieve return value of called function?
- Adding subdomain to home_url for “add_menu_page”
- How to show phpinfo() only in a new tab?
- How to find error in my code when the error message is pointing to WP core file?
- How to select the contents in the text view textrea in wp_editor?
- hook that when page is starting to load
- How to change home or site url using action hooks or filter?
- How to access global variable $menu inside a class function
- ajax, right way to do it and make it works?
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- How can I remove a function that has been added to wordpress with add_filter?
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- How to sanitize any integer input field in wordpress?
- Edit incorrect password message WordPress
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- Custom user login page by creating a plugin
- Singelton class does not work, multiple initialization on page reload
- Saving an array of dynamic repeater data as post_meta
- what is the best practice to add new field to an api route
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- How to upload a file to a folder named after the user_id via plugin
- Reprinting tags with all attributes
- Reload part of checkout on changed shipping method
- Trying to build simple deposit code that hooks into woocommerce
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Use custom post type for a store locator
- developing a wordpress plugin, have a few PHP Woocommerce related coding questions
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Remove metabox from WordPress menu editor page?
- Add a product to checkout via form
- Improve page speed loading using CDN and async or defer attribute
- How do I programmatically set a user as spam in BuddyPress? [closed]
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Why ajax doesn’t work on certain wordpress hooks?
- How to use $_GET function WordPress backend
- Whitelisting items from custom options page
- Add_menu_page not displaying the menu in class based plugin
- Remove a div from RSS feed
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- How to call plugin function per site in a multisite?
- user_profile_update_errors hook not executing
- Set meta field to publish date + 2 weeks
- How to add an arrow to menu items has submenus
- Update results, Before deleting the related category [closed]
- WordPress Gravatar filter is removing my custom attributes
- How to make my custom widget appear within WordPress widgets? Plugin development
- Script to browser problem PHP
- adjust section according to country?
- Error in custom php function doesn’t exist
- How to auto fetch customer details in Woocommerce in checkout page
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Can’t upload image using media_sideload_image
- Don’t insert if permalink is the same?
- Store a default value for a transient on plugin activation
- Return a numerical function value in Customizer controls
- WP CRON duplicate wp_insert_post with has < and > tag
- How wp-cron can run in background if PHP is single threaded?
- How to insert data into database using wp cron job
- How to send Ajax request from my plugin in admin dashboard?
- I want to add custom add to cart link [closed]
- Options API get_option() and update_option() Not Correctly Updating or Returning