{"id":847,"date":"2024-05-07T11:44:22","date_gmt":"2024-05-07T11:44:22","guid":{"rendered":"https:\/\/kb.shortpixel.com\/docs\/list-of-constants-to-add-in-wp-config-php\/"},"modified":"2025-10-05T15:44:28","modified_gmt":"2025-10-05T15:44:28","password":"","slug":"list-of-constants-to-add-in-wp-config-php","status":"publish","type":"docs","link":"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/list-of-constants-to-add-in-wp-config-php\/","title":{"rendered":"List of constants to add in wp-config.php"},"content":{"rendered":"\n<p>The functionality of <a href=\"https:\/\/wordpress.org\/plugins\/shortpixel-image-optimiser\/\" target=\"_blank\" rel=\"noopener\">ShortPixel Image Optimizer<\/a> can be extended by defining&nbsp;<strong>constants<\/strong>&nbsp;on the <code class=\"inline-code\">wp-config.php<\/code> file. What this means is that we can add several lines on that file&nbsp;to add some advanced features to the plugin.<\/p>\n\n\n\n<p>First, locate the file, which must be on the root of your WordPress installation, and edit it.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-csQY0JWrjD.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>Now, you must add each line <strong>before<\/strong> the line that says<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* That's all, stop editing! Happy blogging. *\/<\/code><\/pre>\n\n\n\n<p>We will see an example later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List of constants<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_CUSTOM_THUMB_SUFFIXES', '_tl,_tr');<\/code><\/pre>\n\n\n\n<p>If you have a theme which creates thumbnails that don&#8217;t have the usual suffix <code class=\"inline-code\">image-WWWxHHH.jpg<\/code> , where <code class=\"inline-code\">WWW<\/code> is the width and <code class=\"inline-code\">HHH<\/code> is the height of the image, and you want such thumbnails to be handled by ShortPixel too,&nbsp;you should add this line and add all the custom suffixes your theme is creating separated by commas.&nbsp;<\/p>\n\n\n\n<p>For example, the line above will handle the images with the suffixes <strong>_tl<\/strong> and <strong>_tr<\/strong>, like <code class=\"inline-code\">image-100x100_tl.jpg<\/code> or <code class=\"inline-code\">image-100x100_tr.jpg<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_CUSTOM_THUMB_INFIXES', '-uae');<\/code><\/pre>\n\n\n\n<p>This constant does the same as the previous but treating infixes. For example, custom thumbnails like <code class=\"inline-code\">image-uae-100x100.jpg<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_USE_DOUBLE_WEBP_EXTENSION', true);<\/code><\/pre>\n\n\n\n<p>This tells the plugin to create double extensions for the WebP image counterparts. Obviously, this is valid only if the&nbsp;WebP option is selected on Settings &gt; ShortPixel &gt; WebP\/AVIF &amp; CDN (<a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/how-to-serve-webp-files-using-spio\/\" rel=\"noopener\">learn more<\/a>).&nbsp;This means that your WebP files will have the extension&nbsp;<code>.jpg.webp<\/code>&nbsp;(or <code>.png.webp<\/code> if it\u2019s a PNG)&nbsp;instead of <code>.webp<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_USE_DOUBLE_AVIF_EXTENSION', true);<\/code><\/pre>\n\n\n\n<p>Similarly, this constant tells the plugin to create double extensions for the AVIF image counterparts. Again, this is valid only if the&nbsp;AVIF option is selected on Settings &gt; ShortPixel &gt; WebP\/AVIF &amp; CDN (<a href=\"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-create-and-serve-avif-files-using-shortpixel-image-optimizer\/\">learn more<\/a>).&nbsp;In conclusion, your AVIF files will have the extension <code>.jpg.avif<\/code> (or <code>.png.avif<\/code> if it&#8217;s a PNG)&nbsp;instead of <code>.avif<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_API_KEY', '&lt;&lt;your api key here&gt;&gt;');<\/code><\/pre>\n\n\n\n<p>If you would like to set your API key through the wp-config.php file instead of the Settings screen, you can do so with this <code>define<\/code>. Just replace&nbsp;<code>&lt;&lt;your api key here&gt;&gt;<\/code>&nbsp;with your actual API Key.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_HIDE_API_KEY', true);<\/code><\/pre>\n\n\n\n<p>In case you need to hide the API key from your Settings screen, use this constant. It will appear like this:&nbsp;<code>************<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define(\"SHORTPIXEL_NOFLOCK\", true);<\/code><\/pre>\n\n\n\n<p>This will make your site to not use the <em>flock<\/em> queue; only activate this when you have&nbsp;<code class=\"inline-code\">flock()<\/code> denied errors on your installation.<\/p>\n\n\n\n<section class=\"callout-red\">Deprecated from v5.0<\/section>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define(\"SHORTPIXEL_EXPERIMENTAL_SECURICACHE\", true);<\/code><\/pre>\n\n\n\n<p>This adds timestamps to the URLs, to prevent hitting the cache. It&#8217;s useful for persistent caches.<\/p>\n\n\n\n<section class=\"callout-red\">Deprecated from v5.0<\/section>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_CFTOKEN', '&lt;&lt;the Cloudflare API token that has Purge Cache right&gt;&gt;');\ndefine('SHORTPIXEL_CFZONE', '&lt;&lt;The Zone ID from the domain settings in Cloudflare&gt;&gt;');<\/code><\/pre>\n\n\n\n<p>Hide the Cloudflare settings (Settings &gt; ShortPixel &gt; Integrations).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_NO_BANNER', true);<\/code><\/pre>\n\n\n\n<p>Hide the FastPixel banner on the Settings screen.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_SILENT_MODE', true);<\/code><\/pre>\n\n\n\n<p>Disables completely the notification system of the plugin. In other words, no notifications will be displayed anymore by the plugin, including important ones related to the plugin well functioning (such as conflicts with other plugins, credit-related notifications, etc.).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-yAEn2H4aWn.jpg\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The functionality of ShortPixel Image Optimizer can be extended by defining&nbsp;constants&nbsp;on the wp-config.php file. What this means is that we can add several lines on that file&nbsp;to add some advanced features to the plugin. First, locate the file, which must be on the root of your WordPress installation, and edit it. Now, you must add [&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-847","docs","type-docs","status-publish","hentry","doc_category-shortpixel-image-optimizer"],"blocksy_meta":[],"year_month":"2026-05","word_count":582,"total_views":"1183","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\/847","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=847"}],"version-history":[{"count":3,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/847\/revisions"}],"predecessor-version":[{"id":2704,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/847\/revisions\/2704"}],"wp:attachment":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/media?parent=847"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_category?post=847"},{"taxonomy":"glossaries","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/glossaries?post=847"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_tag?post=847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}