I have managed to do the following. I made a clear cache button:
function advanza_direct_plugin_delete_transients() {
delete_transient( 'advanza_direct_terms_of_service' );
delete_transient( 'advanza_direct_privacy_policy' );
// at the end redirect to target page
exit( wp_redirect( admin_url( 'admin.php?page=advanza-direct-plugin-settings' ) ) );
}
add_action( 'admin_post_advanza_direct_plugin_delete_transients', 'advanza_direct_plugin_delete_transients' );
I put this where I have my admin logic:
<form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
<input type="hidden" name="action" value="advanza_direct_plugin_delete_transients">
<?php submit_button( 'Clear cache', 'delete', '', false ); ?>
</form>
Related Posts:
- Are transients garbage collected?
- How does object caching work?
- Will it break my site if I delete all transient records in wp_options table?
- When should I be using the Transients API?
- Is get_option() faster than accessing get_transient()?
- Cache remote (HTTP) request with Transients API
- Is there any danger in deleting all transients?
- Why are transients cleared prematurely?
- Get a list of existing transients
- Storing posts social counters by using transient api
- Fallback when Transient API fails
- How to save new transients if query changes?
- Integrating WP-TLC-Transients with WordPress – Where to Begin?
- Is priming a Transient Cache possible?
- Long option names fail silently?
- What causes a transient to changes status to “Does Not Expire”?
- What to use , set_transient, set_option or file system? [closed]
- Reset Transient on New Day
- How to use transients and variables
- Transient storage location? database/xcache/w3Total Cache?
- How to delete transients written by fetch_feed()?
- Set Transient expiration
- How to cache posts based on $_GET? Option name is too long? Options / transients
- WordPress transient doesn’t use the transient
- How do I reset a transient when updating a widget’s value?
- How to clear Transients on all sites in Multi Sites environment
- Is this the proper usage of creating / using a transient?
- Should I use the Transients API to temporarily hold edited attachements?
- transient or not transient
- Storing product price data in the database
- Can Transients be used to store sensitive data?
- wp_options flooded with transient API entires
- Transients API conditional
- Why Transients may not work correctly?
- How many transients is too many transients
- Synchronize Data every minute with set_transient
- Difference between get_site_transient() and get_transient()
- delete_transient on click inside a widget form
- Set_Transient to end at midnight
- Custom Plugin Options Won’t Update
- Whats wrong with this transient? Not caching as expected
- Set transient with get posts error
- Clear Transients
- Unique Transients user id for Non-Logged In users
- Managing and deleting transients with dynamically generated transient names
- Transient is never set. Why?
- Set transient name
- Hacked site using transient API?
- Delete Transient when clicking ‘Save Changes’ on options page
- Ajax call to transients
- Why can’t I save encrypted data in a transient?
- Doesn’t set_transient() add multiple rows with the same key?
- Theme / Divi change visitor css and site logo and all site urls based on REQUEST_URI non logged in wp user
- What would cause set_transient() and set_site_transient() to fail silently?
- How to show all columns’ names on a large pandas dataframe?
- GCC -fPIC option
- How to print the full NumPy array, without truncation?
- Upgrade 4.5.2 to 4.5.3 deleting row in wp_options table
- Get page ID of page that is set as the posts page
- How to get WordPress Time Zone setting?
- framework for plugin/theme options panel? [closed]
- How to get the Date Format and Time Format settings for use in my template?
- Add multiple custom fields to the general settings page
- How do I add CSS options to my plugin without using inline styles?
- Are all options loaded to memory on each request?
- ‘Global’ settings page for multisite plugin
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- How to pass arguments from add_settings_field() to the callback function?
- How to use checkbox and radio button in options page?
- how to update serialized options programatically?
- get_option() vs get_theme_mod(): Why is one slower?
- Slow Query for the wp_options table
- Should I use Transient API to store HTML String, or Object?
- How to add Custom Blog Options to new blog setup form?
- Is get_option function cached?
- How to pass variable to add_settings_section() callback?
- How come `wp_options` table does not have an index on `autoload`?
- How to add field for new site-wide option on Network Settings screen?
- Update Option Stored in Multi-Dimensional Array
- Contact form 7 select box different value-text than content-text in option [closed]
- Performance with autoload and the options table
- Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?
- What’s the difference between Options & Settings?
- Using widget options ‘outside’ the widget
- Please explain how WordPress works with MySQL character set and collation at a low level
- What are the advantages to the Settings API?
- How to load WordPress on non WP page?
- From a security standpoint, should bloginfo() or get_bloginfo() be escaped?
- Where to securely store API keys and passwords in WordPress?
- Adding Widget form fields dynamically
- Where to store plugin settings fields
- Enable page templates. How?
- How to store widget fields data as an array?
- Using jQuery to delete data stored in wp_options
- Limit the number of inactive widgets
- This CSS Stuffing Works, But Is This A Good Practice?
- Modifying a JS file with data from plugin settings
- Add update notification bubble to admin menu item?
- Options for CDN with WordPress Including Supporting Plugins?
- Option to set static front page disappeared from admin reading settings