As of WordPress 6.3, the in_footer
parameter is now bundled into the args
array parameter (source).
The correct syntax for the wp_enqueue_script()
function is now as follows (leaving out the named function parameter as it not officially supported by WP core):
wp_enqueue_script( string $handle, string $src="", string[] $deps = array(), string|bool|null $ver = false, array|bool $args = array() )
In your case, you would write your function as follows:
$args = array(
'in_footer' => 'true'
);
wp_enqueue_script('swiper-script', 'https://unpkg.com/swiper@8/swiper-bundle.min.js', [], false, $args);
Your revised wp_enqueue_script()
function you now rely on works because there is still backwards compatibility for the in_footer
parameter as @Howdy_McGee points out, (see here), but only if you’re not specifying in_footer: true
and instead just true
since the parameter is removed from the function declaration.
Related Posts:
- Get only enqueued styles and scripts of the current theme
- Trigger a php file on every post or page if a condition is met
- Enqueue less file not working in child theme?
- Execute only on a certain page
- How to execute a simple php script in WP (I don’t think wp_enque_script applies here)
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- if file_exists not working with wp_enqueue_style
- enqueue hover function
- Adding tawk.to code just before body tag on functions.php file
- How to enqueue CSS and JS only on specific template?
- Deregistering a script in WordPress seems impossible
- How to inject variables into public-facing JS using wp_enqueue_script
- How to only enqueue script if it’s a post
- WordPress Scripts Being Loaded in Footer
- Jquery function working in Dev Console but not otherwise [duplicate]
- jQuery code not working when included in functions.php
- Conditional Javascript based on WP Version
- Is the wp_enqueue method efficient?
- Correct way to enqueue page specific CSS file
- linking stylesheets and scripts with functions.php
- Double jQuery loaded
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- How to use wordpress function wp_enqueue_script() in php?
- Enqueing External JS on the remote server JS
- Trying to enqueue script – Nothing Happens
- url_to_postid returns 0
- ‘Bones’ theme: Load stock scripts in footer instead of header?
- Enqueueing a code block from an options framework
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Using Google Analytics in an enqueued JS file
- Enqueue assets from multiple directories using add_action/do_action
- How to change order inside foreach using wp_enqueue_script?
- Call a single function on two different methods with hooks
- Enqueue sripts and styles only if function is called
- Load script and styles using an array of resources
- Importing the style and scripts in the plugin doesn’t work as well as in the theme
- When to use wp_register_script() function?
- How to stop loading my custom scripts files for wordpress iframe?
- How can I enqueue comment-reply script only on certain page?
- Chosen Select jquery Not Working in Plugin
- Adding javascript files to WordPress and jQuery version
- How can I print out a single stylesheet or javascript link?
- Adding Gravity Form With if(is_page) Is Not Working
- wp_enqueue_style conflict when using in different action hooks
- Errors while Loading Most Recent Version of jQuery
- Warning: filemtime(): stat failed for wp_
- How to enqueue structured data as file – jsonld file seems not to work
- Make a variable global and use it for inline script
- functions.php doesn’t load all custom theme assets
- Getting the action’s tag name within the action
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- How to add query vars with paginated URLs?
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- Get only the grandchildren, not the direct children of page/current page?
- How to add SVG icon above product tab title
- WP_Query sort using multiple numeric meta values
- custom widget on the footer
- WordPress does not load page.php, return 404.php
- How can I apply_filters from inside a function?
- I want to load in a new class but only if the current page is single-movies.php
- wp query foreach deleting record returning only first or last item
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Skt full width basic slideshow problem
- RTL Stylesheet Confusion with WordPress
- get_template_part() not firing within a switch statement when template has new WP_Query
- How to show/hide php table rows based on the content of custom fields
- How to determine from a different folder (outside wordpress) if a visitor is logged into WordPress
- how to get serialized post meta
- Scheduling an event inside plugin class is not working
- How to catch wordpress post ID when it’s published
- WordPress widget and customize.php not working in Ubuntu16.04 VPS
- Class property seems to lose scope, attached to save_post action?
- exclude custom post type from running a function
- WordPress – Get Posts with Category data
- Call to “admin_notices” hook from a static method
- How to Create custom block for displaying information in content section which act like shortcode
- How to use Page link field with is_page()
- Running SMTP Conditionally
- How can I pass php code as a content while publishing a post
- Trying to show the category of a post in the post display
- 500 Error, Get custom field and returning it
- How do I add this OnClick event script to a custom button I’ve created?
- How can i limit the number of posts to the most recent 6 in my query?
- Post content, PHP help
- Access certain Entry in HTML-Table and pass the entry-data in WP not working [closed]
- I want url from a file in media using title file
- how to get buddy press messages based on thready_id?
- Widget Logic – display on page and all child
- How to associate dynamic PHP page for chosen WordPress tag?
- Get dimensions of logo
- Add custom filter to register data in array
- Why does WP_Query show only the same post even with different categories and endwhile?
- How to display different widgets on specific pages, hide from other pages
- js code not stored in database currectly
- echo php values in table – strange behaviour, not all values are shown
- php-page with db connection
- Search results always returns “No results” no matter what
- Changing upload directory temporarily
- Adding extra cost to woocommerce flat rate based on shipping zone
- Date not working correctly