{"id":5000,"date":"2019-07-04T12:16:48","date_gmt":"2019-07-04T06:46:48","guid":{"rendered":"https:\/\/phpyouth.com\/blog\/?p=5000"},"modified":"2025-10-08T19:05:30","modified_gmt":"2025-10-08T13:35:30","slug":"remove-wc_sessions-in-woocommerce","status":"publish","type":"post","link":"https:\/\/phpyouth.com\/blog\/remove-wc_sessions-in-woocommerce\/","title":{"rendered":"How to Remove wc_sessions in WooCommerce"},"content":{"rendered":"<p>Hello friends!<br \/>\nToday, in this tutorial, we will learn how to remove sessions in WooCommerce. First, we will discuss why we need to remove these sessions from WooCommerce. These sessions make the <strong>wp_options<\/strong> table heavy in size. WooCommerce stores the <strong>_wc_session_xxx<\/strong> and <strong>_wc_session_expires_xxx<\/strong> entries in the wp_options table.<\/p>\n<p>There are two reasons behind this, and below are:<\/p>\n<ol>\n<li>Cron tasks are not working on the site<\/li>\n<li>A bot is crawling your site and creating sessions on the fly<\/li>\n<\/ol>\n<p>That&#8217;s the reason, <strong>_wc_session_xxx<\/strong> and <strong>_wc_session_expires_xxx<\/strong> entries are stored in the <em>wp_options<\/em> table and make your website Database heavy.<\/p>\n<p>We can avoid the bots from creating these sessions while crawling the website. What we have to do is we need to add the following code to the <strong>robots.txt<\/strong> file. You can find this file in the website root directory.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nUser-agent: *\nDisallow: \/&lt;em&gt;add-to-cart=&lt;\/em&gt;\n<\/pre>\n<p>Let&#8217;s see how we can remove these sessions from WooCommerce. There are two ways to do this. Below are:<\/p>\n<ol>\n<li>Through the WordPress Dashboard<\/li>\n<li>From phpMyAdmin<\/li>\n<\/ol>\n<h2>1. Through the WordPress Dashboard<\/h2>\n<p>From the Dashboard, WooCommerce provides a <strong>Tool <\/strong>feature through which we can delete these <em>Sessions<\/em>. Here are the steps, please follow:<\/p>\n<ol>\n<li>Log in to your website Dashboard. Click <strong>Status<\/strong>, sub-menu of WooCommerce, see screenshot below&#8230;<br \/>\n<a href=\"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/WooCommerce-Status.png?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-5026\" src=\"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/WooCommerce-Status.png?resize=180%2C302&#038;ssl=1\" alt=\"WooCommerce Status\" width=\"180\" height=\"302\" srcset=\"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/WooCommerce-Status.png?w=180&amp;ssl=1 180w, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/WooCommerce-Status.png?resize=179%2C300&amp;ssl=1 179w\" sizes=\"(max-width: 180px) 100vw, 180px\" \/><\/a><\/li>\n<li>On the WooCommerce <em>Status<\/em> page, click on the <em>Tools<\/em> tab, Find <strong>Clear customer sessions,<\/strong> and beside this, you will see the <strong>Clear<\/strong> button, see screenshot below&#8230;<a href=\"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-5027\" src=\"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?resize=1365%2C465&#038;ssl=1\" alt=\"Clear WC Sessions\" width=\"1365\" height=\"465\" srcset=\"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?w=1365&amp;ssl=1 1365w, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?resize=300%2C102&amp;ssl=1 300w, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?resize=768%2C262&amp;ssl=1 768w, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?resize=1024%2C349&amp;ssl=1 1024w, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Clear-WC-Sessions.png?resize=610%2C208&amp;ssl=1 610w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/li>\n<li>Once you hit the <strong>Clear <\/strong>button, all sessions will be deleted automatically.<\/li>\n<li>But sometimes, the Database is so big that the process of deleting session entries fails because of either low <em>PHP Execution time<\/em> or low <em>Memory limit<\/em>. In that case, we have to delete these sessions from <em>phpMyAdmin<\/em>.<\/li>\n<\/ol>\n<h2>2 From phpMyAdmin<\/h2>\n<p>If your process fails from the WordPress Dashboard, then don&#8217;t worry, we can delete these sessions from <em>phpMyAdmin<\/em> as well. We need to run a MySQL query on the <strong>wp_options<\/strong> table. Copy below MySQL query below and run it in your database.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDELETE FROM wp_options\nWHERE option_name LIKE &amp;#039;&lt;em&gt;wc_session&lt;\/em&gt;%&amp;#039; OR option_name LIKE &amp;#039;&lt;em&gt;wc_session_expires&lt;\/em&gt;%&amp;#039;\n<\/pre>\n<p>At last, if you want to avoid the <strong>wp_options<\/strong> table from becoming so big, then make sure that cron isn\u2019t disabled on your website. To do so, please check your WordPress install <strong>does NOT contain<\/strong> the line below; if so, then remove it or make <em>FALSE<\/em>:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndefine(&#039;DISABLE_WP_CRON&#039;, &#039;true&#039;);\n<\/pre>\n<p>Friends, if you follow these steps, your website will definitely load fast. Please let me know through your comments if this article helps you. Keep learning.<\/p>\n<p><a href=\"https:\/\/www.hostg.xyz\/aff_c?offer_id=6&amp;aff_id=115521&amp;url_id=35&amp;file_id=1399\" target=\"_blank\" rel=\"noopener\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/media.go2speed.org\/brand\/files\/hostinger\/6\/EN-970x250.jpg?resize=970%2C250&#038;ssl=1\" width=\"970\" height=\"250\" border=\"0\" alt=\"\"><\/a><img loading=\"lazy\" decoding=\"async\" style=\"position: absolute; visibility: hidden;\" src=\"https:\/\/www.hostg.xyz\/aff_i?offer_id=6&amp;file_id=1399&amp;aff_id=115521&amp;url_id=35\" width=\"0\" height=\"0\" border=\"0\" alt=\"\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends! Today, in this tutorial, we will learn how to remove sessions in WooCommerce. First, we will discuss why we need to remove these sessions from WooCommerce. These sessions make the wp_options table heavy in size. WooCommerce stores the _wc_session_xxx and _wc_session_expires_xxx entries in the wp_options table. There are two reasons behind this, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5033,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,185,4],"tags":[189,118,187,188],"class_list":["post-5000","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-plugins","category-woocommerce","category-wordpress","tag-disable_wp_cron","tag-phpmyadmin","tag-wc_sessions","tag-woocommerce"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/07\/Remove-woocommerce-sessions.png?fit=560%2C315&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8zepR-1iE","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":5041,"url":"https:\/\/phpyouth.com\/blog\/remove-woocommerce-billing-fields\/","url_meta":{"origin":5000,"position":0},"title":"How to Remove WooCommerce Billing Fields","author":"RK Jajoria","date":"August 8, 2019","format":false,"excerpt":"Hello friends, Good Morning! Today, we are going to learn a WooCommerce trick. This trick is about how to remove WooCommerce billing fields. I want to tell you that WooCommerce is a very powerful WordPress tool that converts a simple website into an E-commerce one. Nowadays, if we look at\u2026","rel":"","context":"In &quot;WooCommerce&quot;","block_context":{"text":"WooCommerce","link":"https:\/\/phpyouth.com\/blog\/category\/wordpress\/plugins\/woocommerce\/"},"img":{"alt_text":"Remove WooCommerce billing fields","src":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/08\/Remove-WooCommerce-billing-fields.png?fit=560%2C315&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/08\/Remove-WooCommerce-billing-fields.png?fit=560%2C315&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/08\/Remove-WooCommerce-billing-fields.png?fit=560%2C315&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":5055,"url":"https:\/\/phpyouth.com\/blog\/how-to-manage-woocommerce-checkout-fields\/","url_meta":{"origin":5000,"position":1},"title":"How to Manage WooCommerce Checkout Fields","author":"RK Jajoria","date":"August 12, 2019","format":false,"excerpt":"Hello friends! In my last article, we discussed how to remove WooCommerce billing fields from the checkout page using custom code. Now, you might be wondering why I\u2019m mentioning that again. Well, it\u2019s because today we\u2019ll be talking about the\u00a0 WooCommerce Checkout Field Editor plugin. Unlike custom coding, this plugin\u2026","rel":"","context":"In &quot;Plugins&quot;","block_context":{"text":"Plugins","link":"https:\/\/phpyouth.com\/blog\/category\/wordpress\/plugins\/"},"img":{"alt_text":"checkout field editor","src":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/08\/checkout-field-editor.png?fit=560%2C315&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/08\/checkout-field-editor.png?fit=560%2C315&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2019\/08\/checkout-field-editor.png?fit=560%2C315&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":5259,"url":"https:\/\/phpyouth.com\/blog\/list-woocommerce-products-on-google-shopping\/","url_meta":{"origin":5000,"position":2},"title":"List Your Woocommerce Products On Google Shopping","author":"RK Jajoria","date":"June 23, 2022","format":false,"excerpt":"I heard many times that WordPress is not good for creating an online store. However, it is totally a myth. In fact, WordPress allows you to design any website, and you can create your own online store with the help of the WooCommerce plugin. Furthermore, WooCommerce helps online stores connect\u2026","rel":"","context":"In &quot;Plugins&quot;","block_context":{"text":"Plugins","link":"https:\/\/phpyouth.com\/blog\/category\/wordpress\/plugins\/"},"img":{"alt_text":"List your woocommerce products on google shopping","src":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2022\/06\/List-your-woocommerce-products-on-google-shopping.webp?fit=560%2C315&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2022\/06\/List-your-woocommerce-products-on-google-shopping.webp?fit=560%2C315&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2022\/06\/List-your-woocommerce-products-on-google-shopping.webp?fit=560%2C315&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":7286,"url":"https:\/\/phpyouth.com\/blog\/top-15-woocommerce-plugins-for-your-store-in-2025\/","url_meta":{"origin":5000,"position":3},"title":"Top 15 WooCommerce Plugins for Your Store in 2025","author":"RK Jajoria","date":"December 20, 2024","format":false,"excerpt":"WordPress stands out as one of the most effective platforms for building and managing eCommerce sites, thanks to its remarkable flexibility and vast selection of WooCommerce plugins. These plugins are essential tools to optimize your store\u2019s performance, enhance the customer experience, and boost sales. Choosing the Top 15 WooCommerce plugins\u2026","rel":"","context":"In &quot;Plugins&quot;","block_context":{"text":"Plugins","link":"https:\/\/phpyouth.com\/blog\/category\/wordpress\/plugins\/"},"img":{"alt_text":"Top 15 Best WooCommerce Plugins in 2025","src":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2024\/12\/15-Best-WooCommerce-Plugins.webp?fit=729%2C410&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2024\/12\/15-Best-WooCommerce-Plugins.webp?fit=729%2C410&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2024\/12\/15-Best-WooCommerce-Plugins.webp?fit=729%2C410&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2024\/12\/15-Best-WooCommerce-Plugins.webp?fit=729%2C410&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":12487,"url":"https:\/\/phpyouth.com\/blog\/best-hosting-for-woocommerce\/","url_meta":{"origin":5000,"position":4},"title":"Best Hosting for WooCommerce in 2026: What Actually Works for Online Stores","author":"RK Jajoria","date":"May 12, 2026","format":false,"excerpt":"If you're looking for the best hosting for WooCommerce in 2026, this guide is based on real stores we've tested; not just benchmark tools. A client came to us last year with a WooCommerce store that was doing decent traffic, nothing crazy, maybe 300\u2013400 visitors a day. But their cart\u2026","rel":"","context":"In &quot;Web Hosting&quot;","block_context":{"text":"Web Hosting","link":"https:\/\/phpyouth.com\/blog\/category\/web-hosting\/"},"img":{"alt_text":"Best Hosting for WooCommerce","src":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2026\/05\/Best-woocommerce-hosting.webp?fit=1200%2C658&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2026\/05\/Best-woocommerce-hosting.webp?fit=1200%2C658&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2026\/05\/Best-woocommerce-hosting.webp?fit=1200%2C658&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2026\/05\/Best-woocommerce-hosting.webp?fit=1200%2C658&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2026\/05\/Best-woocommerce-hosting.webp?fit=1200%2C658&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":5178,"url":"https:\/\/phpyouth.com\/blog\/woocommerce-released-3-9-in-2020\/","url_meta":{"origin":5000,"position":5},"title":"WooCommerce Released 3.9 in 2020","author":"RK Jajoria","date":"January 29, 2020","format":false,"excerpt":"Hello Friends, I just received an email from Woocommerce regarding their new version released. So I thought you guys also know that WooCommerce Released 3.9 in 2020. So friends please read the article till the end and share your experience. The year 2020, a new decade started and January month\u2026","rel":"","context":"In &quot;WooCommerce&quot;","block_context":{"text":"WooCommerce","link":"https:\/\/phpyouth.com\/blog\/category\/wordpress\/plugins\/woocommerce\/"},"img":{"alt_text":"WooCommerce3.9","src":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2020\/01\/WooCommerce3.9.png?fit=560%2C315&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2020\/01\/WooCommerce3.9.png?fit=560%2C315&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/phpyouth.com\/blog\/wp-content\/uploads\/2020\/01\/WooCommerce3.9.png?fit=560%2C315&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/posts\/5000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/comments?post=5000"}],"version-history":[{"count":0,"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/posts\/5000\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/media\/5033"}],"wp:attachment":[{"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/media?parent=5000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/categories?post=5000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpyouth.com\/blog\/wp-json\/wp\/v2\/tags?post=5000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}