Huh. It had never actually occurred to me to use widget instance as cache. I hadn’t ever seen such implementation either.
This is quite an original idea, and as such it is hard to accurately point out benefits and issues with implementation. For starters update()
doesn’t actually save anything, it just used as check for actual save and I won’t say where saving even happens from quick look because it’s abstracted deeper.
From my experience the more traditional implementation would be to cache using more conventional approach (such as transients) and tie it to API, not to widget.
As argument for that imagine user puts two different instances of widget in two different sidebars, but configures them the same way. They will be polling API at double rate, while they actually need exactly same data from API and could (and should) share it.
Related Posts:
- How to save widget fields generated from an array?
- SELECT field options disappear when saving widget
- What is the quickest way to make a widget?
- Widget Options Not saving
- Indexes of widgets instances starts with ‘2’ in ‘wp_options’ table
- Complex widget form UI – examples and best practices
- Remove before_widget / after_widget content from Wp_Widget_Text
- Is It Possible to Restore Accidentally Deleted Widgets?
- How do I create a widget that only allows a single instance?
- Separate backend “Widgets” page for each language
- how to extend a WP_widget twice
- How to access widget data from outside widget?
- Defer Code in Widgets – Page Speed
- How does the default recent posts widget work with cache?
- Add new section to “Right Now” widget
- Creating a admin widget for /wp-admin/post.php?
- Creating a one click demo importer
- Custom widget select options needs to stay selected after save
- Why won’t my custom widget stay in the sidebar after a reload?
- Why does WordPress stores widget options in a multidimensional array?
- Warning: Creating default object… when altering Customize panels
- Remove image height/width attributes from Image Widget
- Extending WP_Widget throws error when Monster Widget used
- get_option returns undesired blank instance of a widget
- How to get options of all active widgets ?
- Add a specific css to a widget
- Save button is not working on custom widget
- Enabled checkbox by default in WordPress widgets
- accessing wordpress serialized data outside wp
- In widget, the value of select field doesn’t get updated, changes after saving
- Got a problem with a widget
- Problem with WP_Query loop and search term
- How to update the options table for a widget
- Widget settings disappear after refreshing page
- Use customizer or sidebar for header settings?
- Options page for widget
- Custom tabs widget don’t work in google chrome, is blocked, do not change the tabs. Why?
- Passing widget options to external script
- Widget options – where to put them?
- Extending Widgets – Exclude # of posts field from Recent Posts Widget
- Using widget options ‘outside’ the widget
- Text Widget creates a
- dynamically add scripts to WP_Widget widget() method
- Changes in widget customizer not triggering ‘save and publish’
- How do i manually place a widget code
- Insert a span inside widget title to give a different color to the second word
- Making a configurable field translatable
- How to add css classes to widgets using functions.php?
- Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?
- How to use get_option() without any filter?
- Widget – Store and update data
- passing variables inside a widget add_action
- Making the default “Latest Posts” WordPress Widget Show Thumbnails
- Add description to custom text widget and display the 5 recent post titles
- Add individual tag to widget title in sidebar
- How to allow your custom widget as block in gutemberg editor
- How to add just one specific page to widget without plugin?
- Adding custom field in all widgets, but at the top of the form, in admin area
- Newbie: Help with Vertical Spacing on Footer Widget [closed]
- Copy Widget Settings because of changed IDs
- Widget Option is Missing
- Why is my custom widget breaking another one?
- Show a widget as a sidebar fallback
- disbale default widgets on theme activation
- in_widget_form detect sidebar id
- Warning: Illegal string offset on theme options page [closed]
- Enqueue scripts based on options
- function WP_Widget::widget() must be over-ridden in a sub-class. when create new Widget
- How to move top widget to the left – Responsive Theme WordPress
- How do I deactivate widgets by name?
- How to register a widget when saving a post?
- Using more widget in main page cause slow loading WordPress? [closed]
- Add links widget to self-hosted blog?
- How to add Ajax to the default widget calendar to support next/previous months loading?
- Widget where it can make changes to the container
- prevent custom widget file names from showing in Appearance > Editor
- Last Update time in widget
- Adding dashboard widgets to show – custom post type stats, information from other plugins
- Upgraded to 3.3, My Widgets Disappeared
- Dynamic Bootstrap Carousel ID per widget on same page
- Tabs widget from Elementor is not showing the content in it to users. But at admin side it is working fine
- Widget title showing below widget
- How to narrow the area between buttons on Helium theme sidebar? [closed]
- How to add the option to choose between sizes for featured image within post editor?
- Get a list of all Widgets registered in WordPress admin widgets-area
- How to implement widgets error output with data validation?
- how to get value of a select box in custom widget wordpress
- Using the_widget Multiple Times
- Nonce and widget
- Confused about customising widgets
- How to give a File Upload option in wordpress Widget backend?
- Pass widget variable to external function
- Can I use widgets & shortcode if I need to return an array?
- Widget area does not show any contents for specific users in admin interface. How to go about debugging?
- Creating an custom admin page for editing widgets
- How to customize dynamic_sidebar rendering? [closed]
- How to show WordPress Dashboard Widgets on Frontend?
- how to add multiple menu in custom menu widget?
- Can’t edit the widgets sidebar or footer
- Custom dashboard widget – load style only for added widget