Go to Admin > System > Cache Management

I want to disable flush image cache button in backend given Which is highlighted in bellow image for security purpose.

Can anyone give me solution.


enter image description here

  • For all user or specific user – Amit Bera Mar 11 at 7:03
  • @AmitBera For all user – Parthavi Mar 11 at 8:41

You cannot just directly remove this button, but you can remove access to this button

Goto System -> Permissions -> User Roles

Open the role that you want to edit

Under "Additional Cache Management" you will find "Catalog Images Cache" disable it from here

But if you still want to remove this button, you need to override it's phtml file

Add new xml file in Vendor/Module/view/adminhtml/layout/adminhtml_cache_index.xml

code in this file would be:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="content">
            <block class="Magento\Backend\Block\Cache\Additional" name="cache.additional" template="Vendor_Module::system/cache/additional.phtml">
                    <argument name="permissions" xsi:type="object">Magento\Backend\Block\Cache\Permissions</argument>

And add your phtml file in your module in: Vendor/Module/view/adminhtml/templates/system/cache/additional.phtml use code:

 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

// @codingStandardsIgnoreFile

/** @var \Magento\Backend\Block\Cache\Permissions|null $permissions */
$permissions = $block->getData('permissions');
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
    <div class="additional-cache-management">
        <?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
                <span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
            <?php /* ?><p>
                <button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
                    <?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
                <span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span>
            </p><?php */ ?>
        <?php endif; ?>
        <?php if ($permissions->hasAccessToFlushJsCss()): ?>
                <button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button">
                    <?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?>
                <span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span>
        <?php endif; ?>
        <?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?>
                <button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button">
                    <?= $block->escapeHtml(__('Flush Static Files Cache')); ?>
                <span><?= $block->escapeHtml(__('Preprocessed view files and static files')); ?></span>
        <?php endif; ?>
        <?= $block->getChildHtml() ?>
<?php endif; ?>
  • I am not able to find "Additional Cache Management" – Parthavi Mar 11 at 6:44
  • System > User Roles > Role Resources – fmsthird Mar 11 at 6:47
  • Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S – Shoaib Munir Mar 11 at 6:49
  • Can u give me another solution to disable button – Parthavi Mar 11 at 7:15
  • Sure, let me try – Shoaib Munir Mar 11 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.