{"id":16316,"date":"2026-08-31T07:12:32","date_gmt":"2026-08-31T07:12:32","guid":{"rendered":"https:\/\/www.24x7wpsupport.com\/blog\/?p=16316"},"modified":"2026-08-31T07:16:15","modified_gmt":"2026-08-31T07:16:15","slug":"add-ajax-load-more-infinite-scroll-wordpress-2026","status":"publish","type":"post","link":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/","title":{"rendered":"How to Add AJAX Load More and Infinite Scroll in WordPress (2026)"},"content":{"rendered":"<p>Numbered pagination sends a reader to a new page. That means a fresh request, a fresh render, and a wait. Many of them never click page two at all.<\/p>\n<p>AJAX load more fixes that. Posts arrive underneath the ones already on screen. Nothing reloads and the reader stays where they were. Infinite scroll does the same thing, but it fires on its own as the reader nears the bottom.<\/p>\n<p>This guide shows you how to build both from scratch. You get the PHP, the JavaScript, and the exact files each part belongs in. Everything here works on current WordPress releases in 2026.<\/p>\n<h2>How AJAX Load More Actually Works in WordPress<\/h2>\n<p>The idea is simple once you see the shape of it. Your page loads the first batch of posts as normal. A button sits below them. When it is clicked, the browser asks the server for the next batch and drops the HTML into the page.<\/p>\n<p>WordPress gives you a built-in endpoint for this. It lives at <code>wp-admin\/admin-ajax.php<\/code>. Every AJAX request you make goes there, and WordPress routes it based on an action name you send along.<\/p>\n<p>There are three moving parts. First, a PHP handler that runs a query and returns markup. Second, a JavaScript file that calls the handler. Third, the data that connects them, such as the endpoint URL, the current page number, and a security token.<\/p>\n<p>You also need to know how many pages exist. WordPress stores this on the main query object as <code>max_num_pages<\/code>. Without it, your button keeps asking for posts that are not there.<\/p>\n<p>The whole flow takes about sixty lines of code. Once it works for posts, the same pattern works for any custom post type.<\/p>\n<h2>Step 1: Register Your Script and Pass Data to It<\/h2>\n<p>Your JavaScript cannot guess the AJAX URL or the nonce. You have to hand those over from PHP. WordPress does this with <code>wp_localize_script<\/code>.<\/p>\n<p>Add this to your child theme <code>functions.php<\/code> file. It loads a script and attaches a small data object to it.<\/p>\n<pre><code>add_action( 'wp_enqueue_scripts', 'wps_load_more_assets' );\r\nfunction wps_load_more_assets() {\r\n    global $wp_query;\r\n\r\n    wp_enqueue_script(\r\n        'wps-load-more',\r\n        get_stylesheet_directory_uri() . '\/js\/load-more.js',\r\n        array( 'jquery' ),\r\n        '1.0',\r\n        true\r\n    );\r\n\r\n    wp_localize_script( 'wps-load-more', 'wpLoadMore', array(\r\n        'ajaxurl'   =&gt; admin_url( 'admin-ajax.php' ),\r\n        'nonce'     =&gt; wp_create_nonce( 'wps_load_more' ),\r\n        'startPage' =&gt; 1,\r\n        'maxPages'  =&gt; $wp_query-&gt;max_num_pages,\r\n    ) );\r\n}<\/code><\/pre>\n<p>The dependency array names <code>jquery<\/code>, so WordPress loads jQuery first. The <code>true<\/code> at the end puts your script in the footer, which stops it blocking the initial render.<\/p>\n<p>Look at what goes into the data object. The <code>ajaxurl<\/code> value comes from <code>admin_url<\/code> and points at admin-ajax.php. The nonce is a one-time token that proves the request came from your site. The <code>startPage<\/code> begins at one because page one is already on screen. The <code>maxPages<\/code> value comes from the global query.<\/p>\n<p>Two mistakes are common here. Calling <code>wp_localize_script<\/code> before <code>wp_enqueue_script<\/code> does nothing, because there is no handle to attach data to yet. And running this outside the <code>wp_enqueue_scripts<\/code> hook means it never fires. Get both right and your JavaScript will find a global object named <code>wpLoadMore<\/code>.<\/p>\n<p>If jQuery is missing on your site, the console will show an error. Our guide to <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/how-to-fix-wordpress-jquery-is-not-defined-error\/\">fixing the WordPress jQuery is not defined error<\/a> covers that case.<\/p>\n<h2>Step 2: Write the PHP Handler That Returns Posts<\/h2>\n<p>The handler is the piece that does the real work. It reads the requested page number, runs a query, and prints the post markup.<\/p>\n<p>WordPress needs two hooks for this. The <code>wp_ajax_<\/code> hook covers logged-in users. The <code>wp_ajax_nopriv_<\/code> hook covers everyone else. Register the same callback on both or your button will silently fail for visitors.<\/p>\n<pre><code>add_action( 'wp_ajax_wps_load_more', 'wps_load_more_handler' );\r\nadd_action( 'wp_ajax_nopriv_wps_load_more', 'wps_load_more_handler' );\r\n\r\nfunction wps_load_more_handler() {\r\n    check_ajax_referer( 'wps_load_more', 'nonce' );\r\n\r\n    $paged = isset( $_POST['page'] ) ? intval( $_POST['page'] ) : 1;\r\n\r\n    $q = new WP_Query( array(\r\n        'post_type'      =&gt; 'post',\r\n        'post_status'    =&gt; 'publish',\r\n        'posts_per_page' =&gt; 10,\r\n        'paged'          =&gt; $paged,\r\n    ) );\r\n\r\n    if ( $q-&gt;have_posts() ) {\r\n        while ( $q-&gt;have_posts() ) {\r\n            $q-&gt;the_post();\r\n            get_template_part( 'template-parts\/content', 'excerpt' );\r\n        }\r\n    }\r\n\r\n    wp_reset_postdata();\r\n    wp_die();\r\n}<\/code><\/pre>\n<p>Every line here matters. The <code>check_ajax_referer<\/code> call validates the nonce and stops the request if it fails. The <code>intval<\/code> on the page value blocks anyone from injecting something odd. The <code>wp_reset_postdata<\/code> call restores the main query so the rest of the page still behaves.<\/p>\n<p>Notice the <code>wp_die<\/code> at the end. Without it, WordPress appends a zero to your response and your markup arrives with a stray character on the end.<\/p>\n<p>Keep <code>posts_per_page<\/code> the same as your <em>Settings \u2192 Reading<\/em> value. If the two disagree, your pages will overlap or skip posts. Ten is a sensible default and keeps each response small.<\/p>\n<h2>Step 3: Add the JavaScript That Fetches the Next Batch<\/h2>\n<p>Now connect the button to the handler. The script tracks which page it is on, asks for the next one, and appends what comes back.<\/p>\n<pre><code>jQuery(function ($) {\r\n    var page = wpLoadMore.startPage;\r\n    var loading = false;\r\n\r\n    $('#wps-load-more').on('click', function () {\r\n        if (loading || page &gt;= wpLoadMore.maxPages) { return; }\r\n        loading = true;\r\n        page++;\r\n\r\n        $.post(wpLoadMore.ajaxurl, {\r\n            action: 'wps_load_more',\r\n            nonce: wpLoadMore.nonce,\r\n            page: page\r\n        }, function (html) {\r\n            $('#wps-posts').append(html);\r\n            loading = false;\r\n            if (page &gt;= wpLoadMore.maxPages) {\r\n                $('#wps-load-more').hide();\r\n            }\r\n        });\r\n    });\r\n});<\/code><\/pre>\n<p>Walk through the logic. The <code>loading<\/code> flag stops a double click from firing two requests. The page counter goes up before the request so the server knows what to send. The action value must match the string in your PHP hook name exactly, or WordPress will not know which function to run.<\/p>\n<p>The <code>append<\/code> call adds the new HTML after the existing posts. Using <code>html<\/code> instead would wipe out what is already there.<\/p>\n<p>The last block hides the button once the final page arrives. Readers should never click a button that does nothing. If you skip this, the button stays forever and returns empty responses.<\/p>\n<p>The container selector needs to match your theme. Open the page, right click a post, and choose Inspect. Find the element that wraps all the posts and use its class or ID.<\/p>\n<h2>Step 4: Turn the Button Into True Infinite Scroll<\/h2>\n<p>Infinite scroll is the same request with a different trigger. Instead of waiting for a click, you watch the reader position and fire when they get close to the end.<\/p>\n<p>The old way was to listen to the scroll event and measure offsets. That runs hundreds of times a second and makes the page feel heavy. Modern browsers give you a better tool called <code>IntersectionObserver<\/code>.<\/p>\n<p>Put an empty div below your posts and let the browser tell you when it comes into view.<\/p>\n<pre><code>var sentinel = document.querySelector('#wps-sentinel');\r\n\r\nvar observer = new IntersectionObserver(function (entries) {\r\n    if (entries[0].isIntersecting) {\r\n        jQuery('#wps-load-more').trigger('click');\r\n    }\r\n}, { rootMargin: '400px' });\r\n\r\nif (sentinel) { observer.observe(sentinel); }<\/code><\/pre>\n<p>The <code>rootMargin<\/code> value is the important part. Setting it to 400px means the request starts while the sentinel is still four hundred pixels below the viewport. Posts are usually ready by the time the reader arrives, so the page never appears to stall.<\/p>\n<p>There is a real trade-off here. Infinite scroll hides your footer, which is where contact links and legal pages usually live. It also breaks the browser back button on many themes.<\/p>\n<p>A hybrid works best for most sites. Auto-load the first two or three batches, then show a button. Readers get the smooth feel without losing the footer.<\/p>\n<h2>Where to Put Each Piece of Code Safely<\/h2>\n<p>Code placement decides whether your work survives the next update. There are three sensible homes and one common mistake.<\/p>\n<p>The mistake is editing the <code>functions.php<\/code> file of a parent theme. The next theme update erases it and your load more button disappears. If you want to use a theme file, set up a child theme first. Our guide on <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/what-is-a-wordpress-child-theme-2026\/\">what a WordPress child theme is<\/a> walks through it in a few minutes.<\/p>\n<p>For the PHP, a small plugin is the cleanest option. Create a folder at <code>wp-content\/plugins\/ajax-load-more<\/code>, add a PHP file inside it, and give it a plugin header comment. Activate it from the Plugins screen. Now the feature is independent of your theme entirely.<\/p>\n<p>For the JavaScript, create a <code>js<\/code> folder inside your child theme and save the file as <code>load-more.js<\/code>. That path has to match the one in your enqueue call exactly, or the browser will request a file that does not exist.<\/p>\n<p>Never paste PHP into a widget or the post editor. It will not run and it may print raw code to your visitors. Edit these files over SFTP rather than the built-in editor, because a single typo there can lock you out of the admin area.<\/p>\n<h2>Testing, Debugging and Common Failures<\/h2>\n<p>Test in a private window first. Logged-in behaviour and visitor behaviour go through different hooks, and a button that works for you may fail for everyone else.<\/p>\n<p>Open your browser tools and go to the Network tab. Click load more and watch for a request to admin-ajax.php. What you see there tells you exactly what is wrong.<\/p>\n<p>A 400 response almost always means the nonce failed or the action name does not match. Check the spelling on both sides. A 403 usually means a security plugin is blocking the endpoint for visitors. If you hit a 400, we have a full walkthrough of the <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/how-to-fix-wordpress-admin-ajax-php-400-bad-request-error\/\">admin-ajax.php 400 bad request error<\/a>.<\/p>\n<p>A response of <code>0<\/code> means WordPress found no handler for your action. You either forgot the nopriv hook or misspelled the action string.<\/p>\n<p>A 200 response with empty content usually means the query ran out of posts. Log the page number and compare it with <code>max_num_pages<\/code>.<\/p>\n<p>Caching causes the strangest bugs. A full page cache can serve an old version of your page with stale nonce data, which makes the first click fail and later clicks work. Exclude admin-ajax.php from caching and clear everything before you test again.<\/p>\n<h2>Keeping It Fast and Search Friendly<\/h2>\n<p>Loading more posts is only a win if the page stays quick. A few habits keep it that way.<\/p>\n<p>Send only the fields you need. If your query does not use taxonomy terms or custom fields, set <code>update_post_term_cache<\/code> and <code>update_post_meta_cache<\/code> to false. On a large site this removes several database queries per request.<\/p>\n<p>Watch your images. Twenty extra posts means twenty extra images, and browsers will fetch them all at once without help. Native lazy loading solves this, and our guide on <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/how-to-enable-or-disable-wordpress-lazy-loading\/\">enabling or disabling WordPress lazy loading<\/a> covers the settings.<\/p>\n<p>Search engines need a path to every post. Crawlers do not scroll and they do not click buttons. Keep real paginated URLs such as <code>\/page\/2\/<\/code> working underneath your AJAX layer, and make sure your sitemap lists every post.<\/p>\n<p>If you would rather skip admin-ajax.php altogether, the REST API is a faster route for read requests. It skips much of the admin bootstrap, so responses come back sooner. Our guide to <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/what-is-the-wordpress-rest-api-2026\/\">the WordPress REST API<\/a> explains the endpoints.<\/p>\n<p>Finally, add a visible loading state. A spinner or a simple word tells the reader something is happening. Without it, a slow connection just looks broken.<\/p>\n<h2>Understanding the Query Behind It All<\/h2>\n<p>Everything above depends on one thing: getting the right posts for the right page. That is the job of <code>WP_Query<\/code> and the <code>paged<\/code> argument.<\/p>\n<p>The <code>paged<\/code> value tells WordPress which slice of results you want. Pass 2 with ten posts per page and you get posts eleven through twenty. Pass nothing and you always get the first ten, which is why a broken counter shows the same posts over and over.<\/p>\n<p>You can filter this query as tightly as you like. Add a category, a tag, a post type, or a meta comparison. The load more logic does not change at all, because it only ever increments a number.<\/p>\n<p>Use <code>max_num_pages<\/code> rather than counting posts yourself. WordPress calculates it from the total found rows and your per page setting, so it stays correct even as you publish more.<\/p>\n<p>If the loop syntax is unfamiliar, our explainer on <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/how-to-create-and-use-the-wordpress-loop\/\">how to create and use the WordPress loop<\/a> covers the structure your handler depends on.<\/p>\n<h2>Get Expert Help With Your WordPress Build<\/h2>\n<p>Load more looks small until it meets a real site. A caching layer, a security plugin, or a theme that renders posts in an unexpected place can each break it, and the failure is usually silent.<\/p>\n<p>Our team builds this kind of feature every week. We wire up AJAX and REST endpoints, tune the queries behind them, keep the paginated URLs crawlable, and make sure the whole thing survives your next theme update. You get a faster archive page and a setup you do not have to maintain yourself.<\/p>\n<p>Visit <a style=\"color: #ffba00; text-decoration: underline;\" href=\"https:\/\/www.24x7wpsupport.com\">24&#215;7 WP Support<\/a> to talk to a WordPress expert. We are available around the clock, and the first conversation costs you nothing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Numbered pagination sends a reader to a new page. That means a fresh request, a fresh render, and a wait. &#8230;<\/p>\n","protected":false},"author":1,"featured_media":16327,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1096],"tags":[2618,2614,2616,2615,2442,2619,2617],"class_list":["post-16316","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-admin-ajax","tag-ajax-wordpress","tag-infinite-scroll","tag-load-more-posts","tag-wordpress-development","tag-wordpress-pagination","tag-wp_query"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>AJAX Load More in WordPress | 24x7 WP Support<\/title>\n<meta name=\"description\" content=\"Add AJAX load more and infinite scroll to WordPress in 2026. Full PHP and JavaScript code, the right files to edit, and fixes for the common errors.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AJAX Load More in WordPress | 24x7 WP Support\" \/>\n<meta property=\"og:description\" content=\"Add AJAX load more and infinite scroll to WordPress in 2026. Full PHP and JavaScript code, the right files to edit, and fixes for the common errors.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7WPSupport Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/24x7wpsupport\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-31T07:12:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-31T07:16:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2026\/08\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress-1024x576.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"576\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Brian\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wpsupport24x7\" \/>\n<meta name=\"twitter:site\" content=\"@wpsupport24x7\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brian\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/\"},\"author\":{\"name\":\"Brian\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#\\\/schema\\\/person\\\/40ee989d8d57096afc53a526d6e612b0\"},\"headline\":\"How to Add AJAX Load More and Infinite Scroll in WordPress (2026)\",\"datePublished\":\"2026-08-31T07:12:32+00:00\",\"dateModified\":\"2026-08-31T07:16:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/\"},\"wordCount\":1883,\"publisher\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png\",\"keywords\":[\"admin-ajax\",\"ajax wordpress\",\"infinite scroll\",\"load more posts\",\"WordPress development\",\"wordpress pagination\",\"wp_query\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/\",\"url\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/\",\"name\":\"AJAX Load More in WordPress | 24x7 WP Support\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png\",\"datePublished\":\"2026-08-31T07:12:32+00:00\",\"dateModified\":\"2026-08-31T07:16:15+00:00\",\"description\":\"Add AJAX load more and infinite scroll to WordPress in 2026. Full PHP and JavaScript code, the right files to edit, and fixes for the common errors.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png\",\"contentUrl\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png\",\"width\":2560,\"height\":1440,\"caption\":\"Add AJAX Load More and Infinite Scroll in WordPress\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/add-ajax-load-more-infinite-scroll-wordpress-2026\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Add AJAX Load More and Infinite Scroll in WordPress (2026)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/\",\"name\":\"24x7WPSupport Blog\",\"description\":\"WordPress Theme Update | WordPress Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#organization\",\"name\":\"24x7 WP Support\",\"url\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/wpsupportlatestlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/wpsupportlatestlogo.png\",\"width\":269,\"height\":64,\"caption\":\"24x7 WP Support\"},\"image\":{\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/24x7wpsupport\",\"https:\\\/\\\/x.com\\\/wpsupport24x7\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.24x7wpsupport.com\\\/blog\\\/#\\\/schema\\\/person\\\/40ee989d8d57096afc53a526d6e612b0\",\"name\":\"Brian\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5a5a62eb3263db905a008db8d80b6777dd5792da217d72772ec4c23dc58ec9d6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5a5a62eb3263db905a008db8d80b6777dd5792da217d72772ec4c23dc58ec9d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5a5a62eb3263db905a008db8d80b6777dd5792da217d72772ec4c23dc58ec9d6?s=96&d=mm&r=g\",\"caption\":\"Brian\"},\"description\":\"Brian is a WordPress support specialist and content contributor at 24x7 WP Support. He writes practical, easy-to-follow guides on WordPress troubleshooting, WooCommerce issues, plugin and theme errors, website security, migrations, performance optimization, and integrations. With a focus on solving real website problems, Brian helps business owners, bloggers, and online store managers keep their WordPress sites running smoothly.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AJAX Load More in WordPress | 24x7 WP Support","description":"Add AJAX load more and infinite scroll to WordPress in 2026. Full PHP and JavaScript code, the right files to edit, and fixes for the common errors.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/","og_locale":"en_GB","og_type":"article","og_title":"AJAX Load More in WordPress | 24x7 WP Support","og_description":"Add AJAX load more and infinite scroll to WordPress in 2026. Full PHP and JavaScript code, the right files to edit, and fixes for the common errors.","og_url":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/","og_site_name":"24x7WPSupport Blog","article_publisher":"https:\/\/www.facebook.com\/24x7wpsupport","article_published_time":"2026-08-31T07:12:32+00:00","article_modified_time":"2026-08-31T07:16:15+00:00","og_image":[{"width":1024,"height":576,"url":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2026\/08\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress-1024x576.png","type":"image\/png"}],"author":"Brian","twitter_card":"summary_large_image","twitter_creator":"@wpsupport24x7","twitter_site":"@wpsupport24x7","twitter_misc":{"Written by":"Brian","Estimated reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#article","isPartOf":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/"},"author":{"name":"Brian","@id":"https:\/\/www.24x7wpsupport.com\/blog\/#\/schema\/person\/40ee989d8d57096afc53a526d6e612b0"},"headline":"How to Add AJAX Load More and Infinite Scroll in WordPress (2026)","datePublished":"2026-08-31T07:12:32+00:00","dateModified":"2026-08-31T07:16:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/"},"wordCount":1883,"publisher":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#primaryimage"},"thumbnailUrl":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2026\/08\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png","keywords":["admin-ajax","ajax wordpress","infinite scroll","load more posts","WordPress development","wordpress pagination","wp_query"],"articleSection":["WordPress"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/","url":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/","name":"AJAX Load More in WordPress | 24x7 WP Support","isPartOf":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#primaryimage"},"image":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#primaryimage"},"thumbnailUrl":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2026\/08\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png","datePublished":"2026-08-31T07:12:32+00:00","dateModified":"2026-08-31T07:16:15+00:00","description":"Add AJAX load more and infinite scroll to WordPress in 2026. Full PHP and JavaScript code, the right files to edit, and fixes for the common errors.","breadcrumb":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#primaryimage","url":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2026\/08\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png","contentUrl":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2026\/08\/Add-AJAX-Load-More-and-Infinite-Scroll-in-WordPress.png","width":2560,"height":1440,"caption":"Add AJAX Load More and Infinite Scroll in WordPress"},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7wpsupport.com\/blog\/add-ajax-load-more-infinite-scroll-wordpress-2026\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7wpsupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Add AJAX Load More and Infinite Scroll in WordPress (2026)"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7wpsupport.com\/blog\/#website","url":"https:\/\/www.24x7wpsupport.com\/blog\/","name":"24x7WPSupport Blog","description":"WordPress Theme Update | WordPress Blog","publisher":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7wpsupport.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/www.24x7wpsupport.com\/blog\/#organization","name":"24x7 WP Support","url":"https:\/\/www.24x7wpsupport.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.24x7wpsupport.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2018\/11\/wpsupportlatestlogo.png","contentUrl":"https:\/\/www.24x7wpsupport.com\/blog\/wp-content\/uploads\/2018\/11\/wpsupportlatestlogo.png","width":269,"height":64,"caption":"24x7 WP Support"},"image":{"@id":"https:\/\/www.24x7wpsupport.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/24x7wpsupport","https:\/\/x.com\/wpsupport24x7"]},{"@type":"Person","@id":"https:\/\/www.24x7wpsupport.com\/blog\/#\/schema\/person\/40ee989d8d57096afc53a526d6e612b0","name":"Brian","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/5a5a62eb3263db905a008db8d80b6777dd5792da217d72772ec4c23dc58ec9d6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5a5a62eb3263db905a008db8d80b6777dd5792da217d72772ec4c23dc58ec9d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5a5a62eb3263db905a008db8d80b6777dd5792da217d72772ec4c23dc58ec9d6?s=96&d=mm&r=g","caption":"Brian"},"description":"Brian is a WordPress support specialist and content contributor at 24x7 WP Support. He writes practical, easy-to-follow guides on WordPress troubleshooting, WooCommerce issues, plugin and theme errors, website security, migrations, performance optimization, and integrations. With a focus on solving real website problems, Brian helps business owners, bloggers, and online store managers keep their WordPress sites running smoothly."}]}},"_links":{"self":[{"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/posts\/16316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/comments?post=16316"}],"version-history":[{"count":2,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/posts\/16316\/revisions"}],"predecessor-version":[{"id":16326,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/posts\/16316\/revisions\/16326"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/media\/16327"}],"wp:attachment":[{"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/media?parent=16316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/categories?post=16316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7wpsupport.com\/blog\/wp-json\/wp\/v2\/tags?post=16316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}