Skip to content

Instantly share code, notes, and snippets.

@SJ-James
Created January 3, 2018 11:39
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save SJ-James/2034db86ed54dea09fa0ed4920261660 to your computer and use it in GitHub Desktop.
Save SJ-James/2034db86ed54dea09fa0ed4920261660 to your computer and use it in GitHub Desktop.
Clear Local Storage Button For Divi
<?php
function ClearLocalCacheButton() { ?>
// Create Button
<a href="#" onclick="ClearLocalCache()" class="et-pb-layout-buttons et-pb-layout-buttons-cache" title="Clear Cache">
<span>Clear Cache</span>
</a>
<script type="text/javascript">
// Move Button to Divi Tabs
jQuery(window).load(function(){
jQuery(".et-pb-layout-buttons-cache").insertAfter(jQuery(".et-pb-layout-buttons-clear"));
});
function ClearLocalCache() {
// Clear Storage and Alert User
alert("Local storage has been cleared. Update the page now.");
window.localStorage.clear()
}
</script>
<?php }
add_action('admin_footer', 'ClearLocalCacheButton');
@innotag
Copy link

innotag commented Jan 7, 2018

Working great for me. Thanks very much for the share! :)

@Antera
Copy link

Antera commented Apr 7, 2019

Hi !
Is it still useful for new Divi version ?
Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment