{"id":770,"date":"2024-05-07T11:43:02","date_gmt":"2024-05-07T11:43:02","guid":{"rendered":"https:\/\/kb.shortpixel.com\/docs\/how-to-schedule-a-cron-event-to-run-shortpixel-image-optimizer\/"},"modified":"2025-08-27T08:43:29","modified_gmt":"2025-08-27T08:43:29","password":"","slug":"how-to-schedule-a-cron-event-to-run-shortpixel-image-optimizer","status":"publish","type":"docs","link":"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-schedule-a-cron-event-to-run-shortpixel-image-optimizer\/","title":{"rendered":"How to schedule a cron event to run ShortPixel Image Optimizer"},"content":{"rendered":"\n<p>By default, ShortPixel Image Optimizer (SPIO) only optimizes images if <a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/334-on-what-pages-does-spio-optimize-images\" rel=\"noopener\">one of these pages<\/a> is open on your browser. But what happens if you don&#8217;t have the time (or will) to do it? You can always schedule SPIO to run even when your computer is off. Just follow these instructions.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Option 1: Add a cron job manually<\/h2>\n\n\n\n<section class=\"callout-\">Please note that you <strong>must<\/strong> have the option &#8220;<a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/settings-optimize-media-on-upload\/\" rel=\"noopener\">Optimize media on upload<\/a>&#8221; enabled in order for this to work properly! (The option is enabled by default)<\/section>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install and activate the <a href=\"https:\/\/wordpress.org\/plugins\/wp-crontrol\/\" target=\"_blank\" rel=\"noopener\">WP Crontrol<\/a> plugin.<\/li>\n\n\n\n<li>Go to Tools &gt; Cron Events and then click on &#8220;Add New&#8221;.<br><figure><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-hRx0I25iSB.jpg\"><\/figure><\/li>\n\n\n\n<li><p>In the <strong>Hook Name<\/strong> field, enter <code>shortpixel\/hook\/processqueue<\/code>.\u00a0<\/p><\/li>\n\n\n\n<li><p>In the <strong>Recurrence<\/strong> field, select how often you want ShortPixel to process your images (we recommend once hourly).<\/p><\/li>\n\n\n\n<li><p>Leave the rest of the fields as they are. It should look like this:<br><br><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-ALl6bdHEwN.jpg\"><\/p><\/li>\n\n\n\n<li><p>Click on &#8220;Add Event&#8221;.<\/p><\/li>\n<\/ol>\n\n\n\n<section class=\"callout-blue\">As an alternative to WP Crontrol, the same effect can be achieved with the<br><a href=\"https:\/\/wordpress.org\/plugins\/advanced-cron-manager\/\" rel=\"noopener\">Advanced Cron Manager<\/a> plugin.<\/section>\n\n\n\n<p>After doing this, the newly uploaded images should get processed by our plugin every hour, and you won&#8217;t even need to log in to your WordPress site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Option 2: Use Background mode<\/h2>\n\n\n\n<p>With version 5.6, ShortPixel has introduced a new feature called &#8220;Background Mode&#8221;, which creates cron jobs for you, allowing you to optimize images in the background.<\/p>\n\n\n\n<p>You can find all the information you need here: <a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/background-processing-using-cron-jobs-in-shortpixel-image-optimizer\/\" rel=\"noopener\">Background processing using cron jobs in ShortPixel Image Optimizer<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, ShortPixel Image Optimizer (SPIO) only optimizes images if one of these pages is open on your browser. But what happens if you don&#8217;t have the time (or will) to do it? You can always schedule SPIO to run even when your computer is off. Just follow these instructions.&nbsp; Option 1: Add a cron [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[37],"glossaries":[],"doc_tag":[],"class_list":["post-770","docs","type-docs","status-publish","hentry","doc_category-shortpixel-image-optimizer"],"blocksy_meta":[],"year_month":"2026-04","word_count":238,"total_views":"906","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin","author_nicename":"admin_mdli53m5","author_url":"https:\/\/kb.shortpixel.com\/author\/admin_mdli53m5\/"},"doc_category_info":[{"term_name":"ShortPixel Image Optimizer","term_url":"https:\/\/kb.shortpixel.com\/knowledge-base\/category\/shortpixel-image-optimizer\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/comments?post=770"}],"version-history":[{"count":3,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/770\/revisions"}],"predecessor-version":[{"id":2498,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/770\/revisions\/2498"}],"wp:attachment":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/media?parent=770"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_category?post=770"},{"taxonomy":"glossaries","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/glossaries?post=770"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_tag?post=770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}