Experience the powerful AI writing right inside WordPress
Show stunning before-and-after transformations with image sliders.
Improve user engagement by showing estimated reading time.
Written by Mahmuda Akter Isha
Showcase Designs Using Before After Slider.
To add an auto slider in WordPress, install a slider plugin such as MetaSlider, create a slideshow, upload your images, enable autoplay and looping, and insert the slider using its block or shortcode. You can also create an autoplay slider with the Jetpack Slideshow block, Elementor Image Carousel, or custom code.
An auto slider can help you display multiple images, announcements, products, testimonials, or portfolio items without using a large amount of page space. Instead of requiring visitors to click through every slide, the slider automatically moves from one item to the next.
However, adding autoplay without the right settings can create problems. A slider that moves too quickly may frustrate visitors, while one that loads several large images can slow down your website. It must also provide navigation and pause controls so visitors remain in control.
In this guide, you will learn how to add an auto slider in WordPress using four practical methods:
You will also learn how to adjust the autoplay speed, make your slider responsive, improve accessibility, reduce loading time, and fix common WordPress slider problems.
An auto slider is a website component that automatically rotates through a group of images or content at a predefined interval.
It may also be called:
For example, a homepage slider may display a different promotional banner every five seconds. A portfolio slider may automatically rotate through completed projects, while an online store may use one to highlight featured products.
Although “slider” and “carousel” are often used interchangeably, they can describe slightly different layouts.
A slider normally displays one main item at a time. A carousel may display several items in the same row and move one or more items when it rotates.
An autoplay image slider can be useful when you need to present several related items in a compact section.
Common uses include:
However, not every section needs a slider. If one message or image is significantly more important than everything else, a static hero section may communicate it more clearly.
Use a slider when the slides are related, and visitors can still understand the page without viewing every item.
For most users, a dedicated plugin or an existing page-builder widget is the easiest option. Custom code is more suitable when you are comfortable managing HTML, CSS, JavaScript, and theme files.
A WordPress slider plugin is usually the simplest option because it handles image transitions, autoplay, responsiveness, navigation, and embedding.
For this tutorial, we will use MetaSlider as an example. MetaSlider can be used to build image sliders, galleries, video sliders, post sliders, and WooCommerce product sliders.
The names of individual settings may vary slightly depending on the plugin version and selected slider type.
Log in to your WordPress dashboard and follow these steps:
A new MetaSlider menu should now appear in your WordPress dashboard.
Go to MetaSlider from the dashboard menu.
Click New Slideshow or the equivalent button displayed by your version of the plugin.
Enter a descriptive name for the slider. For example:
The name is mainly for your own organization and does not normally appear to visitors.
Click Add Slide and select images from your WordPress Media Library.
You can also upload new images from your computer.
Before adding the images, prepare them with the same dimensions or aspect ratio. For example, you might use:
Using inconsistent image dimensions can cause the slider height to change as slides rotate.
After adding the images:
Avoid adding too many images. Three to six focused slides are generally easier for visitors to understand than a slider containing fifteen unrelated items.
Select the slider type or layout available in the plugin.
Depending on your configuration, you may see options for:
Choose a simple layout that matches the purpose of the page.
For a homepage banner, one large slide with arrows and dots usually works well. For products or logos, a multi-item carousel may be more suitable.
Open the slider settings and look for an option such as:
Enable the setting.
Then configure the interval or delay between slides. Slider timing is commonly measured in milliseconds.
For example:
A delay of approximately five seconds is a practical starting point for an image-focused slider. Slides containing longer text may need more time.
Do not confuse the autoplay delay with the transition duration.
The autoplay delay controls how long each slide remains visible. The transition duration controls how quickly the movement or fade animation happens.
Enable continuous or infinite looping if you want the slideshow to return to the first image after displaying the last one.
You should also provide manual controls, such as:
Autoplay should not be the only way visitors can move through the slider.
Enable pause on hover where available. This temporarily stops the slider when a visitor places the mouse over it, giving them more time to read or click.
You should also enable pause on interaction if the plugin provides that option.
Adjust the width, height, or aspect ratio based on the images you prepared.
For a responsive slider:
A full-width slider should still have a controlled image height. An extremely tall banner may push the main content too far down the page on mobile devices.
After saving the slider, copy its shortcode or use its dedicated WordPress block.
You may also be able to place the shortcode inside a page builder, widget area, template, or theme section.
Do not rely only on the editor preview.
Open the live page in a private browser window and check:
Also, test the page with caching and optimization features active.
You can create a simple automatic slideshow without installing a dedicated slider plugin if your website has access to a Slideshow block.
WordPress.com includes a Slideshow block, while self-hosted WordPress websites can access a similar block through Jetpack. Jetpack’s Slideshow block is available on Jetpack-connected websites and supports autoplay, delay settings, slide or fade effects, image sizing, and a visitor-facing pause button.
Go to Pages or Posts and edit the content where you want to display the slideshow.
Click the + button to open the block inserter.
Search for:
Slideshow
Select the Slideshow block.
If the block is unavailable on a self-hosted website, you may need to install and connect Jetpack or use a different slideshow block plugin.
Choose one of the available options:
After selecting the images, arrange them in the correct order.
Add suitable alt text to informative images. Alt text should describe the image naturally rather than repeating the same keyword across every slide.
Select the entire Slideshow block and open the settings sidebar.
Find the Autoplay option and enable it.
Set the number of seconds between transitions. WordPress.com’s current Slideshow settings provide an autoplay toggle and a delay control for determining how long each image remains visible.
Start with approximately five seconds and adjust it based on the amount of information displayed.
Select a transition effect such as:
A slide effect creates more visible movement, while a fade transition is usually more subtle.
Avoid overly dramatic animations that distract visitors from the main content.
Select an appropriate image resolution and choose the block alignment.
Available alignment options may include:
Preview the slideshow at different screen sizes before publishing.
Update or publish the page.
Check that:
The block method is ideal for a basic WordPress image slideshow, but a dedicated plugin may be better when you need custom navigation, product feeds, advanced animation, dynamic content, or detailed responsive controls.
If your website uses Elementor, you can create an automatic image slider with the Image Carousel widget.
Elementor’s Image Carousel provides controls for autoplay, autoplay speed, infinite loop, pause on hover, pause on interaction, animation speed, direction, navigation, and lazy loading.
Open the page where you want to add the slider and click Edit with Elementor.
Add a new container or section in the desired location.
Use the Elementor search field to find:
Image Carousel
Drag the widget into the container.
The widget settings will appear in the Elementor panel.
Click Add Images and select the images from the Media Library.
Upload new files if necessary.
Arrange the images in the order you want them to appear.
Choose how many images should appear at the same time.
Adjust the number of slides shown separately for desktop, tablet, and mobile.
A layout that displays four images on desktop may need to display only one or two on a phone.
Find the Autoplay setting and select Yes.
Set the autoplay speed in milliseconds. For example, enter 5000 for a five-second delay.
5000
Configure the other settings:
Pause-on-interaction prevents the slider from immediately moving after a visitor manually selects a slide.
Open the Style tab to adjust:
Maintain enough contrast between the navigation controls and the images behind them.
If white arrows disappear over a light image, add a darker button background or overlay.
Switch between Elementor’s desktop, tablet, and mobile previews.
Check:
Do not simply shrink the desktop slider. Mobile visitors often need a more focused layout with fewer visible items.
Click Update and open the live page.
Test the carousel on an actual mobile device when possible. Elementor’s preview is useful, but it may not reveal every touch, caching, or browser-related issue.
You can also build an automatic image slider using HTML, CSS, and JavaScript.
This method gives you more control and avoids adding a dedicated slider plugin. However, it requires careful implementation to maintain responsiveness, accessibility, and browser compatibility.
Before making changes, back up your website and avoid editing the parent theme directly. Use a child theme or a suitable custom-code area so theme updates do not erase your work.
Add the following HTML to a Custom HTML block or an appropriate template file.
Replace the example image paths and alt text with your own content.
<div class="cc-auto-slider" data-delay="5000" aria-roledescription="carousel" aria-label="Featured images" > <div class="cc-slider-viewport"> <div class="cc-slider-track"> <figure class="cc-slide" aria-label="Slide 1 of 3"> <img src="/wp-content/uploads/slider-image-1.webp" width="1600" height="900" alt="Modern workspace with a laptop and notebook" fetchpriority="high" > </figure> <figure class="cc-slide" aria-label="Slide 2 of 3"> <img src="/wp-content/uploads/slider-image-2.webp" width="1600" height="900" alt="Team members collaborating around a table" loading="lazy" > </figure> <figure class="cc-slide" aria-label="Slide 3 of 3"> <img src="/wp-content/uploads/slider-image-3.webp" width="1600" height="900" alt="Website analytics displayed on a computer screen" loading="lazy" > </figure> </div> </div> <button class="cc-slider-arrow cc-slider-prev" type="button" aria-label="Show previous slide" > <span aria-hidden="true">‹</span> </button> <button class="cc-slider-arrow cc-slider-next" type="button" aria-label="Show next slide" > <span aria-hidden="true">›</span> </button> <div class="cc-slider-footer"> <button class="cc-slider-toggle" type="button"> Pause autoplay </button> <div class="cc-slider-dots" role="group" aria-label="Choose a slide" ></div> </div> <p class="cc-slider-status screen-reader-text" aria-live="polite" aria-atomic="true" ></p> </div>
The first image uses fetchpriority="high" because it is immediately visible. The later images use lazy loading because visitors do not see them initially.
fetchpriority="high"
Only use high fetch priority when the first slider image is an important above-the-fold image.
Add the following CSS under Appearance → Customize → Additional CSS, your Site Editor’s custom CSS area, or your child theme stylesheet.
.cc-auto-slider { position: relative; width: 100%; max-width: 1200px; margin: 0 auto; } .cc-slider-viewport { overflow: hidden; border-radius: 12px; } .cc-slider-track { display: flex; transform: translateX(0); transition: transform 0.55s ease; will-change: transform; } .cc-slide { flex: 0 0 100%; margin: 0; aspect-ratio: 16 / 9; background: #f2f2f2; } .cc-slide img { display: block; width: 100%; height: 100%; object-fit: cover; } .cc-slider-arrow { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 32px; line-height: 1; cursor: pointer; transform: translateY(-50%); } .cc-slider-prev { left: 16px; } .cc-slider-next { right: 16px; } .cc-slider-arrow:hover, .cc-slider-arrow:focus-visible, .cc-slider-toggle:hover, .cc-slider-toggle:focus-visible, .cc-slider-dot:hover, .cc-slider-dot:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; } .cc-slider-footer { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; } .cc-slider-toggle { padding: 8px 14px; border: 1px solid currentColor; border-radius: 6px; background: transparent; cursor: pointer; } .cc-slider-dots { display: flex; gap: 8px; } .cc-slider-dot { width: 12px; height: 12px; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: transparent; cursor: pointer; } .cc-slider-dot[aria-current="true"] { background: currentColor; } .screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; } @media (max-width: 600px) { .cc-slider-arrow { width: 38px; height: 38px; font-size: 28px; } .cc-slider-prev { left: 8px; } .cc-slider-next { right: 8px; } .cc-slider-footer { flex-direction: column; gap: 10px; } } @media (prefers-reduced-motion: reduce) { .cc-slider-track { transition: none; } }
The aspect-ratio property keeps the slider height stable while images load and rotate.
aspect-ratio
Change 16 / 9 if your images use a different aspect ratio.
16 / 9
Add the following JavaScript through a child theme JavaScript file, a custom-code feature provided by your theme, or another safe site-level code area.
Do not edit WordPress core files.
document.addEventListener("DOMContentLoaded", () => { const reducedMotion = window.matchMedia( "(prefers-reduced-motion: reduce)" ).matches; document.querySelectorAll(".cc-auto-slider").forEach((slider) => { const track = slider.querySelector(".cc-slider-track"); const slides = Array.from(slider.querySelectorAll(".cc-slide")); const previousButton = slider.querySelector(".cc-slider-prev"); const nextButton = slider.querySelector(".cc-slider-next"); const toggleButton = slider.querySelector(".cc-slider-toggle"); const dotsContainer = slider.querySelector(".cc-slider-dots"); const status = slider.querySelector(".cc-slider-status"); if (!track || slides.length === 0) { return; } const requestedDelay = Number.parseInt(slider.dataset.delay, 10); const delay = Number.isFinite(requestedDelay) ? Math.max(requestedDelay, 3000) : 5000; let currentIndex = 0; let timer = null; let autoplayEnabled = !reducedMotion; const dots = slides.map((slide, index) => { const dot = document.createElement("button"); dot.type = "button"; dot.className = "cc-slider-dot"; dot.setAttribute("aria-label", `Show slide ${index + 1}`); dot.addEventListener("click", () => { stopAutoplay(); showSlide(index); }); dotsContainer.appendChild(dot); return dot; }); function showSlide(index, announce = true) { currentIndex = (index + slides.length) % slides.length; track.style.transform = `translateX(-${currentIndex * 100}%)`; slides.forEach((slide, slideIndex) => { slide.setAttribute( "aria-hidden", slideIndex === currentIndex ? "false" : "true" ); }); dots.forEach((dot, dotIndex) => { if (dotIndex === currentIndex) { dot.setAttribute("aria-current", "true"); } else { dot.removeAttribute("aria-current"); } }); if (announce && status) { status.textContent = `Slide ${currentIndex + 1} of ${slides.length}`; } } function updateToggleLabel() { toggleButton.textContent = autoplayEnabled ? "Pause autoplay" : "Start autoplay"; toggleButton.setAttribute( "aria-pressed", autoplayEnabled ? "false" : "true" ); } function clearTimer() { if (timer !== null) { window.clearInterval(timer); timer = null; } } function startTimer() { clearTimer(); if (!autoplayEnabled || slides.length < 2) { return; } timer = window.setInterval(() => { showSlide(currentIndex + 1, false); }, delay); } function startAutoplay() { autoplayEnabled = true; updateToggleLabel(); startTimer(); } function stopAutoplay() { autoplayEnabled = false; clearTimer(); updateToggleLabel(); } previousButton.addEventListener("click", () => { stopAutoplay(); showSlide(currentIndex - 1); }); nextButton.addEventListener("click", () => { stopAutoplay(); showSlide(currentIndex + 1); }); toggleButton.addEventListener("click", () => { if (autoplayEnabled) { stopAutoplay(); } else { startAutoplay(); } }); slider.addEventListener("mouseenter", clearTimer); slider.addEventListener("mouseleave", () => { if (autoplayEnabled) { startTimer(); } }); slider.addEventListener("focusin", () => { if (autoplayEnabled) { stopAutoplay(); } }); document.addEventListener("visibilitychange", () => { if (document.hidden) { clearTimer(); } else if (autoplayEnabled) { startTimer(); } }); showSlide(0, false); updateToggleLabel(); startTimer(); }); });
This code:
The delay is controlled by this HTML attribute:
data-delay="5000"
The value is measured in milliseconds.
Examples:
data-delay="3000"
Changes the slide every three seconds.
data-delay="7000"
Changes the slide every seven seconds.
Avoid extremely short intervals. Visitors need enough time to understand each slide and interact with its controls.
Check the slider carefully after adding the code.
Test:
If the custom code does not work, temporarily disable JavaScript optimization and caching features while troubleshooting.
The exact process depends on how your homepage is built.
Open:
Appearance → Editor
Select the homepage template or front-page template. Add the slider block or shortcode to the desired section and save the template.
Go to:
Pages → Home
Edit the page assigned as your homepage and insert the slider block or shortcode.
You can confirm the selected homepage under:
Settings → Reading
Open the homepage with Elementor, add an Image Carousel or slider widget, configure autoplay, and update the page.
Placing a slider directly inside a header or template may require theme-specific controls or template editing.
Use a child theme when editing PHP template files. Never modify the parent theme directly because future theme updates may overwrite your changes.
The ideal settings depend on the type of content, but the following configuration provides a practical starting point.
A promotional image with only a short headline may need less time than a testimonial containing several sentences.
Always watch the finished slider as a visitor would. If you cannot comfortably read a slide before it changes, increase the delay.
An automatically moving slider can be difficult for visitors who need more time to read, use keyboard navigation, or are distracted by animation.
W3C’s carousel guidance recommends giving visitors control over movement, supporting keyboard navigation, and pausing animation when the carousel receives mouse hover or keyboard focus.
Use the following accessibility practices.
Visitors should be able to stop autoplay without leaving the page.
Do not hide the pause control only on hover. It should be easy to find and use with a mouse, keyboard, or touchscreen.
Pause the slider when a visitor:
Do not unexpectedly restart it after a keyboard user has paused it through interaction.
Provide previous and next controls even when autoplay is enabled.
Use real HTML buttons rather than clickable images or non-semantic elements.
A screen reader should understand what each control does.
Useful labels include:
Some visitors configure their operating system to reduce animation.
Use the prefers-reduced-motion media query to remove transitions or disable automatic movement for those visitors.
prefers-reduced-motion
Important information should not depend on visitors waiting for a particular slide.
Keep essential headings, navigation, pricing, contact information, and calls to action available elsewhere on the page.
Text placed over an image may become unreadable when the background changes.
Add an overlay, solid text background, or gradient when necessary. Test every slide rather than checking only the first one.
A poorly optimized slider can load several large images, execute unnecessary scripts, and delay the main content.
The first visible slider image may become the page’s Largest Contentful Paint element. Web performance guidance recommends prioritizing the first visible carousel image while handling later images more cautiously.
Resize images before uploading them.
Do not upload a 5000-pixel photograph when the slider displays it at 1200 pixels.
Use an image compression tool or WordPress image optimization solution.
Use WebP or AVIF where supported. These formats can reduce file sizes while maintaining good visual quality.
Keep a fallback workflow if your image optimization system requires one.
The first image is immediately visible and may be the page’s main visual element.
Lazy-loading it can delay its appearance.
Later slides can usually be lazy-loaded because they are initially outside the visible area.
Define the image dimensions in the HTML or through the plugin.
This helps the browser reserve the required space and reduces layout movement while the images load.
All images should use the same aspect ratio.
For example, do not mix a square image, a portrait image, and a wide banner unless the slider has been intentionally designed to handle those differences.
Every additional slide may add another image request.
Use only the slides that support the page’s main purpose.
One optimized slider may be reasonable. Several sliders at the top of the same page can increase loading time and create a confusing user experience.
Use performance-testing tools to check:
Test the published page rather than only the editor.
Open the browser console and check for JavaScript errors.
This issue is often related to caching or optimization.
Try:
Do not troubleshoot major conflicts directly on a busy production website without a backup.
Also test in more than one mobile browser.
This normally happens when the slider container and images use different aspect ratios.
Use:
img { width: 100%; height: 100%; object-fit: cover; }
object-fit: cover fills the container but may crop part of the image.
object-fit: cover
Use object-fit: contain when displaying the complete image is more important than filling the entire area.
object-fit: contain
Set explicit width and height attributes or define a stable aspect ratio for the slider container.
Also make sure all slides use consistent dimensions.
Check whether you changed:
These settings control different parts of the transition.
Clear all caches after saving the new timing.
This may be expected behavior if pause on interaction is enabled.
This feature prevents the slider from immediately moving after a visitor manually selects a slide.
Modern browsers commonly limit autoplaying video, especially when sound is enabled.
Mute the video, display playback controls, and avoid depending on video autoplay for essential information. MetaSlider also recommends muting videos when autoplay is not being allowed.
An image slider is not automatically good or bad for SEO. Its impact depends on how it is implemented.
A slider may support the page when it:
It may create SEO and usability problems when it:
Google recommends writing useful, contextual alt text and avoiding keyword stuffing.
For example, avoid:
WordPress slider WordPress auto slider automatic WordPress slider image
Use a description such as the following:
Elementor Image Carousel settings with autoplay enabled
The second version describes what the image actually shows.
An automatic slider and a before-and-after image slider serve different purposes.
A before-and-after comparison slider normally places two related images in the same frame and lets visitors drag a handle to reveal the difference.
When your goal is visual comparison rather than automatic rotation, the WP Before After Image Slider provides a more suitable format for presenting the transformation.
Before publishing your slider, follow this checklist:
Adding an auto slider in WordPress does not have to be complicated.
A dedicated slider plugin is the easiest solution for most websites. The WordPress Slideshow block is suitable for a simple image presentation, while Elementor provides visual carousel controls for page-builder websites. Developers can create a lightweight custom slider with HTML, CSS, and JavaScript.
Whichever method you choose, do not focus only on making the images move.
A successful WordPress auto slider should:
Start with a small number of relevant slides, use a comfortable autoplay delay, and test the finished page on multiple devices. This will help you create an automatic slider that looks professional without sacrificing accessibility, performance, or usability.
You can also enable autoplay through an Elementor Image Carousel or a WordPress Slideshow block. Install a WordPress slider plugin, create a slideshow, add your images, and enable the Autoplay setting. Set the delay between slides, enable looping, add navigation controls, and insert the slider with its block or shortcode.
Yes. You can create one with HTML, CSS, and JavaScript.Add the HTML to the page, the CSS to your theme or custom CSS area, and the JavaScript through a child theme or safe site-level code area.Custom development gives you more control but also requires more testing and maintenance.
Open the slider or carousel settings and change the autoplay delay.The value may be displayed in seconds or milliseconds.For milliseconds:3000 = 3 seconds5000 = 5 seconds7000 = 7 seconds
Approximately four to six seconds is a useful starting point.Use a longer delay when a slide contains several lines of text. Test the slider yourself and make sure visitors have enough time to understand each slide.
Enable the Pause on Hover option in your slider plugin or page-builder widget.For a custom slider, use JavaScript mouseenter and mouseleave events to stop and restart the autoplay timer.Keyboard focus should also stop the slider.
Yes. Add Elementor’s Image Carousel widget, select the images, enable Autoplay, set the autoplay speed, enable infinite loop, and configure pause on hover and pause on interaction.
The core block selection may vary depending on the WordPress environment. WordPress.com provides a Slideshow block, and self-hosted websites can access Jetpack’s Slideshow block after connecting Jetpack.Dedicated block plugins may provide additional slider options.
Yes. Use a WooCommerce-compatible product carousel plugin, a page-builder product carousel, or a slider plugin that supports WooCommerce products.Configure the product source, number of products, responsive layout, navigation, and autoplay settings.
Use only the number needed to communicate the message.Three to six slides are generally enough for a homepage hero or promotional section. A product carousel may contain more items if visitors can navigate them easily.
They can be difficult to use when visitors cannot pause them, when slides move too quickly, or when controls are not keyboard accessible.Provide a pause button, manual navigation, suitable timing, focus handling, and reduced-motion support.
They can slow down a page if they load many large images or heavy scripts.Compress the images, use modern formats, prioritize the first visible slide, lazy-load later images, and avoid unnecessary slider libraries.
Some themes and page builders provide a header builder where you can add a slider widget or shortcode.For a custom theme, you may need to edit a template through a child theme. Check whether a large animated header remains usable and fast on mobile devices.
This page was last edited on 13 July 2026, at 6:04 pm
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
How many people work in your company?Less than 1010-5050-250250+
By proceeding, you agree to our Privacy Policy