How to change the caching time interval in Feedzy widget

πŸ“ Note: This guide covers changing the caching time interval for the widget available in the Feedzy RSS Feeds plugin. For more information about the plugin, please check the main documentation.

The caching time in Feedzy RSS Feeds is the time that the plugin waits before checking for new items in the feed. This option ensures the interval for displaying updated feed items from the source.

There are some predefined intervals in the plugin, but using this documentation, you will be able to create custom intervals, so that the feed items will be updated as soon as you need them. By default, it is set to 60 minutes, so that every 60 minutes the plugin will check for updating the feed.


1

Go to Appearance > Widgets.

2

Select the  area where you want to add the Feedzy widget.

3

Search for the Feedzy RSS Feeds widget and add it there.

To add another option to the Feed Caching Time drop-down, paste the following code at the end of the functions.php file of your child theme, according to the editor that you're using and change the caching time to suit your needs: 

Gutenberg Editor Widget

add_action(
  'admin_footer',
  function() { ?>
  <script type="text/javascript">
    wp.hooks.addFilter( 'feedzy_widget_refresh_feed', 'feedzy-rss-feeds/feedzy-block', function( options ) {
      options.push( { label: '1 Minute', value: '1_mins' }, { label: '2 Minute', value: '2_mins' } );
      return options;
    } );
  </script>
    <?php
  }
);

πŸ“ Note: This is just an example with 1 and 2 minutes, but you can change the values and labels as you need.


Classic Editor Widget

function filter_classic_widget_refresh_options( $options ) {
	$options['7_days'] = array(
		'label' => '7' . ' ' . __( 'Days', 'feedzy-rss-feeds' ),
		'value' => '7_hours',
	);
	return $options;
}
add_filter( 'feedzy_classic_widget_refresh_options', 'filter_classic_widget_refresh_options' );

πŸ“ Note: This is just an example, but you can change the values and labels as you need.


Elementor Widget

function filter_elementor_widget_refresh_options( $options ) {
	$options['7_days'] = wp_sprintf( __( '%d Days', 'feedzy-rss-feeds' ), 7 );
	return $options;
}
add_filter( 'feedzy_elementor_widget_refresh_options', 'filter_elementor_widget_refresh_options' );

πŸ“ Note: These can be added at the end of the functions.php file of your theme as well. In this case, you must add this code snippet every time you update the theme.


Legacy code for WordPress versions up to 5.9

add_action(
  'admin_print_footer_scripts',
  function() { ?>
  <script type="text/javascript">
    wp.hooks.addFilter( 'feedzy_widget_refresh_feed', 'feedzy-rss-feeds/feedzy-block', function( options ) {
      options.push( { label: '1 Minute', value: '1_mins' }, { label: '2 Minute', value: '2_mins' } );
      return options;
    } );
  </script>
    <?php
  }
);
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us