{"id":7491,"date":"2020-02-19T16:19:43","date_gmt":"2020-02-19T22:19:43","guid":{"rendered":"https:\/\/wpengine.com\/support\/admin-ajax\/"},"modified":"2020-02-19T16:19:43","modified_gmt":"2020-02-19T22:19:43","slug":"admin-ajax","status":"publish","type":"support","link":"https:\/\/wpengine.com\/support\/admin-ajax\/","title":{"rendered":"WordPress and Admin AJAX"},"content":{"rendered":"<p>AJAX is a powerful tool that allows a website to extend its functionality and create a more seamless end-user experience. All AJAX calls in WordPress\u00ae route through the same location, called Admin AJAX.<sup><a href=\"#legal-disclaimer\">1<\/a><\/sup> Learn when not to use Admin AJAX and how to identify which AJAX actions are being made in excess.<\/p>\n\n\n\n\n\n\n\n<h2 id=\"toc-about-admin-ajax\" class=\"wp-block-heading\">About Admin AJAX<\/h2>\n\n\n\n<p>AJAX is a JavaScript technology that allows data to be requested and returned on a page without actually refreshing the page. For example, in Google Maps, to view new map sections you don\u2019t need to load another page. As you move the map, it will load in new sections without having to fully reload the page.<\/p>\n\n\n\n<p>By default, WordPress routes all AJAX requests through an admin file located at <code>wp-admin\/admin-ajax.php<\/code>. This is why, when referring to AJAX in WordPress, we call it \u201cAdmin AJAX\u201d.<\/p>\n\n\n\n<p>A common example of Admin AJAX in WordPress would be a checkout page on an ecommerce website. When you enter your shipping information, the site can query the database and display an updated price <i>without<\/i> reloading the entire page.<br><a name=\"highajax\"><\/a><\/p>\n\n\n\n\n\n<h2 id=\"toc-high-admin-ajax-usage\" class=\"wp-block-heading\">High Admin AJAX Usage<\/h2>\n\n\n\n<p>When AJAX is called anywhere on a WordPress website, the Admin AJAX file is requested: <code>wp-admin\/admin-ajax.php<\/code>. On WP Engine, the <code>wp-admin\/admin-ajax.php<\/code> file is uncached meaning it is generated new for each request and is <i>never<\/i> served from cache storage. Uncached requests are significantly more resource-intensive than those served from cache.<\/p>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p>To review how WP Engine server caching works, we suggest <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/cache\/\">checking out this guide<\/a>.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<p>While AJAX is a great tool, it can often run amok when set to make inefficient, unnecessary or a high number of calls. For this reason, it\u2019s important to use AJAX calls sparingly and only when completely necessary.<\/p>\n\n\n\n<p>For example, say that when a user visits a page it makes 5 Admin AJAX calls within a few seconds. Remember that AJAX calls are uncached, so all 5 must be processed by PHP anew. When 1 or 2 users are on the page, you may not see any impact with only 10 calls in a few seconds. However, when 5,000 visitors are on the page, you now have 25,000 uncached requests within just a few seconds. With enough visitors on the site pulling resources in this inefficient manner, the server will slow down (causing 504 errors) or even fail to complete requests completely (causing 502 errors).<\/p>\n\n\n\n<p>If you\u2019re seeing a large number of 504 or 502 errors on your site, it\u2019s highly possible that excess Admin AJAX requests are the culprit.<\/p>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-1\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p>Need a refresher on these error codes? Learn more about the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/troubleshooting-502-error\/\">502 error here<\/a>. Learn more about the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/resolving-504-gateway-timeout-errors\/\">504 error here<\/a>.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<a name=\"log\"><\/a>\n\n\n\n\n\n<h2 id=\"toc-admin-ajax-log\" class=\"wp-block-heading\">Admin AJAX Log<\/h2>\n\n\n\n<p>As all AJAX requests go through the <code>wp-admin\/admin-ajax.php<\/code> file, requests are easy enough to track back to a single culprit with some additional logging enabled. If you\u2019re seeing a large amount of requests to <code>wp-admin\/admin-ajax.php<\/code> within your <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/error\/#accesslogs\">access logs<\/a>, your next step will be to enable Admin AJAX logging.<\/p>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-2\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p>Before continuing, be aware that the Admin AJAX log can grow exponentially fast, which can cause issues for your site. <em><strong>Disable Admin AJAX as soon as possible in your troubleshooting process.<\/strong><\/em> We typically find 5-10 minutes to be a sufficient amount of time enabled.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<p>Admin AJAX logging can be enabled by adding the following line to the <code>wp-config.php<\/code> file using either <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/sftp\/\">SFTP<\/a> or <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/ssh-gateway\/\">SSH Gateway<\/a>. Be sure to add this just below the section that says <code># WP Engine Settings<\/code>.<\/p>\n\n\n\n<p><code>define( 'WPE_MONITOR_ADMIN_AJAX', true );<\/code><\/p>\n\n\n\n<p>Once the line is added and the updated wp-config.php file has been uploaded back into the site, Admin AJAX logging will begin. We suggest timing 5 minutes before editing the file again to remove the line. During this time, perform any actions on your site where you\u2019ve seen slowness or errors, to ensure the process in question is logged during the test period.<\/p>\n\n\n\n<p>To disable Admin AJAX logging, open the <code>wp-config.php<\/code> file again and either remove the define above, or update the value to <code>false<\/code>.<\/p>\n\n\n\n<p>To review the log, download it at <code>wp-content\/__wpe_admin_ajax.log<\/code><\/p>\n\n\n\n<p>Finally, be aware that admin AJAX logging only record POST requests. GET requests to <code>admin-ajax.php<\/code> with arguments on the end are not logged. For example:<br><code>admin-ajax.php?action=do_something&amp;that_something=should_be_cool<\/code><br><a name=\"sshgateway\"><\/a><\/p>\n\n\n\n\n\n<h2 id=\"toc-troubleshoot-admin-ajax\" class=\"wp-block-heading\">Troubleshoot Admin AJAX<\/h2>\n\n\n\n<p>We recommend troubleshooting high AJAX with <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/ssh-gateway\/\">SSH gateway<\/a>, if possible, because we have provided some commands to easily parse the log from your terminal below. This is the same approach WP Engine Support will take to troubleshoot the issue, as it\u2019s the most direct. All of the following commands will be run from the root of your website.<\/p>\n\n\n\n<p><b>With AJAX logging enabled, view the AJAX actions live as the request is made on the website:<\/b><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is a good option if you are looking for the AJAX call causing slowness on a particular page. Enable AJAX logging, run the following command, then perform the action on the website.<\/li>\n<\/ul>\n\n\n\n<p><code>tail -f wp-content\/__wpe_admin_ajax.log | grep \"action\"<\/code><\/p>\n\n\n\n<p><b>With AJAX logging disabled, search through the log to pull a list of actions made and the total times each action was requested during the logged period:<\/b><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is a good option if you\u2019re seeing 502 or 504 errors with high AJAX usage.<\/li>\n<\/ul>\n\n\n\n<p><code>grep \"action\" wp-content\/__wpe_admin_ajax.log | sort | uniq -c | sort -rn | head<\/code><\/p>\n\n\n\n<p><b>An example output looks like this:<\/b><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  47608  &nbsp;  [action] =&gt; adrotate_impression\n &nbsp;&nbsp;&nbsp;108 &nbsp;   [action] =&gt; ga_stats_widget\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;96&nbsp; &nbsp;  [action] =&gt; heartbeat\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp; &nbsp; [action] =&gt; wp-remove-post-lock\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp; &nbsp; [action] =&gt; adrotate_click\n      1 &nbsp; &nbsp; [action] =&gt; do-plugin-upgrade\n<\/pre>\n\n\n\n<p>If you\u2019re seeing issues with AJAX performance, the highest number is your most likely culprit. The next step is to determine the offender.<\/p>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-3\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p>The heartbeat action refers to a normal WordPress process that allows for functionality like auto-saving posts and pages. For more information, review the <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/developer.wordpress.org\/plugins\/javascript\/heartbeat-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Heartbeat API Codex here<\/a>. WP Engine disables heartbeat on all non-editing admin pages, so it is unlikely this action will cause any performance issues.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<p><b>Use the following command to search your website\u2019s files for a specific action name:<\/b><\/p>\n\n\n\n<p><code>ack-grep --nosql <strong>action_name<\/strong><\/code><\/p>\n\n\n\n<p>For example, to search a site for the AJAX action <code>adrotate_impression<\/code> using the following:<\/p>\n\n\n\n<p><code>ack-grep --nosql <strong>adrotate_impression<\/strong><\/code><\/p>\n\n\n\n<p>This example query was provided the following results:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><b>wp-content\/plugins\/adrotate\/adrotate-statistics.php<\/b>\n40: &nbsp; &nbsp; &nbsp; &nbsp; return \"&lt;div class=\"adrotate_label\"&gt;\" + label + \"&lt;br \/&gt;&lt;span class=\"adrotate_clicks\"&gt;Clicks:&lt;\/span&gt; \" + env.opt.values['serie1'][index] + \"&lt;br \/&gt;&lt;span class=\"adrotate_impressions\"&gt;Impressions:&lt;\/span&gt; \" + env.opt.values['serie2'][index] + \"&lt;\/div&gt;\";\n479: Name:&nbsp; &nbsp; &nbsp; adrotate_impression_callback\n483:function adrotate_impression_callback() {\n\n<b>wp-content\/plugins\/adrotate\/library\/dashboard.css<\/b>\n4:.adrotate_impressions { color: #F80; font-weight: normal }\n\n<b>wp-content\/plugins\/adrotate\/library\/jquery.adrotate.dyngroup.js<\/b>\n85: $.post(impression_object.ajax_url, {'action': 'adrotate_impression','track': tracker});\n\n<b>wp-content\/plugins\/adrotate\/dashboard\/settings\/statistics.php<\/b>\n69: &lt;input name=\"adrotate_impression_timer\" type=\"text\" class=\"search-input\" size=\"5\" value=\"&lt;?php echo $adrotate_config['impression_timer']; ?&gt;\" autocomplete=\"off\" \/&gt; &lt;?php _e('Seconds.', 'adrotate'); ?&gt;&lt;br \/&gt;\n\n<b>wp-content\/plugins\/adrotate\/adrotate-manage-publisher.php<\/b>\n724: $impression_timer = trim($_POST['adrotate_impression_timer']);\n\n<b>wp-content\/plugins\/adrotate\/adrotate.php<\/b>\n68: add_action('wp_ajax_adrotate_impression', 'adrotate_impression_callback');\n69: add_action('wp_ajax_nopriv_adrotate_impression', 'adrotate_impression_callback');<\/pre>\n\n\n\n<section class=\"attention-block attention-block--info\" role=\"note\" data-analytics-track-visibility=\"yes\">\n\t<div class=\"attention-block__inner\">\n\t\t\t\t<div class=\"attention-block__icon\">\n\t\t\t<span class=\"screen-reader-text\">Information<\/span>\n\t\t\t<span aria-hidden=\"true\"><svg viewBox=\"0 2 24 24\" fill=\"none\">\n<path d=\"M12 11C12.5523 11 13 10.5523 13 10C13 9.44772 12.5523 9 12 9C11.4477 9 11 9.44772 11 10C11 10.5523 11.4477 11 12 11Z\" fill=\"currentColor\" \/>\n<path d=\"M12 12C12.5523 12 13 12.4477 13 13V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V14C10.4477 14 10 13.5523 10 13C10 12.4477 10.4477 12 11 12H12Z\" fill=\"currentColor\" \/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3C5.92487 3 1 7.92487 1 14C1 20.0751 5.92487 25 12 25C18.0751 25 23 20.0751 23 14C23 7.92487 18.0751 3 12 3ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"currentColor\" \/>\n<\/svg>\n<\/span>\n\t\t<\/div>\n\t\t\t\t<div class=\"attention-block__content\">\n\t\t\t<div class=\"attention-block__message\">\n\n<h3 id=\"toc-note-4\" class=\"wp-block-heading\">Note<\/h3>\n\n\n\n<p>We advise <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/restore\/#make\">creating a backup<\/a> of your site before making any changes to plugins or themes.<\/p>\n\n<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n<p>In this example, all the results for search query are located within the plugin directory <code>wp-content\/plugins\/<b>adrotate<\/b><\/code>. The next step would be to check for any updates to the Adrotate plugin, and make sure it\u2019s updated. (<a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/developer.wordpress.org\/cli\/commands\/plugin\/\">WP CLI can help with this<\/a>.) Updating can often resolve issues where an asset\u2019s AJAX usage spikes unexpectedly.<\/p>\n\n\n\n<p>If updating doesn\u2019t resolve the issue, then disabling the item would be the next step. Otherwise, reaching out to the plugin\/theme support will ensure you\u2019re able to get the most help, as fast as possible. We recommend providing the developer with your AJAX logs and findings covered above, as this can greatly improve the overall resolution time.<\/p>\n\n\n\n\n\n<a name=\"WooCommerce_Cart_Fragments\"><\/a>\n\n\n\n<h2 id=\"toc-ecommerce-cart-fragments\" class=\"wp-block-heading\">eCommerce Cart Fragments<\/h2>\n\n\n\n<p>If you\u2019re seeing a large amount of AJAX calls to&nbsp;<code>wc-ajax=get_refreshed_fragments<\/code> this refers to the \u201cCart Fragments\u201d functionality in WooCommerce\u00ae.<sup><a href=\"#legal-disclaimer\">1<\/a><\/sup> The Cart Fragments request is made all the time, even when completely unnecessary, including pages without add-to-cart functionality, like an About Us page, Blog Posts, or on the Terms &amp; Conditions page. This can pose performance issues, especially in times of high traffic.<\/p>\n\n\n\n<p>You can identify the Cart Fragments on a store with any web page speed test, or the website\u2019s&nbsp;<a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/error\/#toc-access-logs\">Access Log<\/a>&nbsp;by adding the following query argument to your domain:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/testsite.wpengine.com\/?<strong>wc-ajax=get_refreshed_fragments<\/strong><\/pre>\n\n\n\n<p>The Cart Fragments will appear as follows in your&nbsp;<a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/error\/#accesslogs\">Access Log<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">31\/Dec\/2017:23:59:59 +0000|v1|1.1.1.1|www.testsite.wpengine.com|200|210|127.0.0.1:80|0.328|0.330|POST \/?<strong>wc-ajax=get_refreshed_fragments<\/strong> HTTP\/2.0||<\/pre>\n\n\n\n<p>There are two options to resolve high calls from Cart Fragments:<\/p>\n\n\n\n<p><strong>Option 1: Enable Live Cart<\/strong><\/p>\n\n\n\n<p>Live Cart is a proprietary performance feature built into WP Engine eCommerce Suites that eliminates the AJAX call from happening at unnecessary times, and improves the scalability of the cart and page speed across your entire store without losing dynamic cart functionality. The biggest benefit is seen when items are added to the cart and during high-traffic events, like a special promotion or event (like Black Friday). When a customer adds an item to the cart, Live Cart loads pages on average 1.5 seconds faster than the default Cart Fragments script and helps keep your store from dropped connections under continuous load. Live Cart is not only faster, but it makes the server more stable and responsive in peak traffic.<\/p>\n\n\n\n<p><a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/ecommerce-solution\/#toc-live-cart-for-woocommerce\">Live Cart is included with WP Engine eCommerce Suites.<\/a><\/p>\n\n\n\n<p><strong>Option 2: Disable Cart Fragments<\/strong><\/p>\n\n\n\n<p>Disabling Cart Fragments will remove the real-time cart functionality but will reduce overall server load and protect your website\u2019s scalability. There are a few ways of disabling WooCommerce Cart Fragments.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>WP Engine eCommerce suite customers can simply <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"internal\" href=\"https:\/\/wpengine.com\/support\/ecommerce-solution\/#toc-live-cart-for-woocommerce\">enable Live Cart<\/a> to maintain the real-time cart while simultaneously improving performance or migrate to <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/woocommerce.com\/posts\/platform-update-high-performance-order-storage-for-woocommerce\/\">HPOS<\/a>.<\/li>\n\n\n\n<li>If Live Cart is not available on your account, disable cart fragments using a plugin such as&nbsp;<a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/wordpress.org\/plugins\/disable-cart-fragments\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u201cDisable Cart Fragments\u201d<\/a>&nbsp;or&nbsp;<a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/perfmatters.io\/docs\/disable-woocommerce-cart-fragments-ajax\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u201cPerfmatters\u201d<\/a> or follow this <a data-analytics-action-type=\"link\" data-analytics-link-location=\"Post Content\" data-analytics-link-type=\"outbound\" href=\"https:\/\/www.webnots.com\/fix-slow-page-loading-with-woocommerce-wc-ajaxget_refreshed_fragments\/\" target=\"_blank\" rel=\"noreferrer noopener\">guide<\/a> to disable cart fragments via the <code>functions.php<\/code>&nbsp;file of your theme. Either of these options will eliminate dynamic cart functionality.<\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.<\/p>\n","protected":false},"featured_media":5937,"template":"","meta":{"_acf_changed":false,"mediapress_draft_name":"","_mediapress_is_draft_copy":false},"audience":[],"buyer-stage":[],"company-and-culture":[],"content-type":[],"location":[],"persona":[],"product":[],"support-category":[137],"support-topic":[147,166,173],"topic":[95,100],"use-cases":[111],"class_list":["post-7491","support","type-support","status-publish","has-post-thumbnail","hentry","support-category-developer-advanced","support-topic-cli","support-topic-ssh","support-topic-troubleshooting","topic-development","topic-wordpress","use-cases-ecommerce"],"acf":{"trending":false,"taxonomy_selector":{"":null,"taxonomy-audience":false,"taxonomy-buyer-stage":false,"taxonomy-company-and-culture":false,"taxonomy-content-type":false,"taxonomy-location":false,"taxonomy-persona":false,"taxonomy-product":false,"taxonomy-support-topic":[147,166,173],"taxonomy-topic":[95,100],"taxonomy-use-cases":[111]}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Manage WordPress Admin AJAX | WP Engine Support<\/title>\n<meta name=\"description\" content=\"Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/support\/admin-ajax\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Manage WordPress Admin AJAX | WP Engine Support\" \/>\n<meta property=\"og:description\" content=\"Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/support\/admin-ajax\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPE-IMG-Thumbnail-1200x630-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/\",\"name\":\"Manage WordPress Admin AJAX | WP Engine Support\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"datePublished\":\"2020-02-19T22:19:43+00:00\",\"description\":\"Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"caption\":\"WP Engine\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/admin-ajax\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpengine.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress and Admin AJAX\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#website\",\"url\":\"https:\\\/\\\/wpengine.com\\\/\",\"name\":\"WP Engine\u00ae\",\"description\":\"Managed Hosting for WordPress\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpengine.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#organization\",\"name\":\"WP Engine\",\"url\":\"https:\\\/\\\/wpengine.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/WPEngine_OGImage-1.webp\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/WPEngine_OGImage-1.webp\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/wpengine\\\/\",\"https:\\\/\\\/x.com\\\/wpengine\",\"https:\\\/\\\/www.instagram.com\\\/wpengine\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpengine\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCJeAEAxX69v24CUBZ0WBYSg\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Manage WordPress Admin AJAX | WP Engine Support","description":"Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.","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:\/\/wpengine.com\/support\/admin-ajax\/","og_locale":"en_US","og_type":"article","og_title":"Manage WordPress Admin AJAX | WP Engine Support","og_description":"Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.","og_url":"https:\/\/wpengine.com\/support\/admin-ajax\/","og_site_name":"WP Engine\u00ae","article_publisher":"https:\/\/www.facebook.com\/wpengine\/","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPE-IMG-Thumbnail-1200x630-1.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/support\/admin-ajax\/","url":"https:\/\/wpengine.com\/support\/admin-ajax\/","name":"Manage WordPress Admin AJAX | WP Engine Support","isPartOf":{"@id":"https:\/\/wpengine.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/support\/admin-ajax\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/support\/admin-ajax\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","datePublished":"2020-02-19T22:19:43+00:00","description":"Admin AJAX is a very flexible tool that can create a more seamless user experience in WordPress. Learn when to use and how to troubleshoot high Admin AJAX.","breadcrumb":{"@id":"https:\/\/wpengine.com\/support\/admin-ajax\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/support\/admin-ajax\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/support\/admin-ajax\/#primaryimage","url":"https:\/\/wpengine.com\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","contentUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","caption":"WP Engine"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/support\/admin-ajax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/"},{"@type":"ListItem","position":2,"name":"WordPress and Admin AJAX"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/#website","url":"https:\/\/wpengine.com\/","name":"WP Engine\u00ae","description":"Managed Hosting for WordPress","publisher":{"@id":"https:\/\/wpengine.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpengine.com\/#organization","name":"WP Engine","url":"https:\/\/wpengine.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/#\/schema\/logo\/image\/","url":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPEngine_OGImage-1.webp","contentUrl":"https:\/\/wpengine.com\/wp-content\/uploads\/2025\/09\/WPEngine_OGImage-1.webp","width":1200,"height":630,"caption":"WP Engine"},"image":{"@id":"https:\/\/wpengine.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/wpengine\/","https:\/\/x.com\/wpengine","https:\/\/www.instagram.com\/wpengine\/","https:\/\/www.linkedin.com\/company\/wpengine\/","https:\/\/www.youtube.com\/channel\/UCJeAEAxX69v24CUBZ0WBYSg"]}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support\/7491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/types\/support"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/media\/5937"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/media?parent=7491"}],"wp:term":[{"taxonomy":"audience","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/audience?post=7491"},{"taxonomy":"buyer-stage","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/buyer-stage?post=7491"},{"taxonomy":"company-and-culture","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/company-and-culture?post=7491"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/content-type?post=7491"},{"taxonomy":"location","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/location?post=7491"},{"taxonomy":"persona","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/persona?post=7491"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/product?post=7491"},{"taxonomy":"support-category","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support-category?post=7491"},{"taxonomy":"support-topic","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/support-topic?post=7491"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/topic?post=7491"},{"taxonomy":"use-cases","embeddable":true,"href":"https:\/\/wpengine.com\/wp-json\/wp\/v2\/use-cases?post=7491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}