Skip to content

Instantly share code, notes, and snippets.

@muks999
Forked from SJ-James/functions.php
Created January 6, 2018 17:31
Show Gist options
  • Save muks999/f643bb3fa7ba295ff183f1d54f59a850 to your computer and use it in GitHub Desktop.
Save muks999/f643bb3fa7ba295ff183f1d54f59a850 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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment