1. Home
  2. Knowledge Base
  3. General Feed Tips
  4. How to Refresh Product Feed Using Cron Jobs

How to Refresh Product Feed Using Cron Jobs

By default, our plugin uses the Action Scheduler to automatically or manually generate and process product feeds. When you click the Refresh button, the plugin triggers a manual scheduled action for the associated feed ID. If you’ve set a refresh interval for a feed, the plugin automatically runs the scheduled action at that interval, based on the UTC+0 timezone.

The plugin processes feeds sequentially, according to the configured batch size. If you haven’t explicitly set a batch size, the plugin uses the default value. You can learn more about configuring batch sizes in this article.

Customizing Feed Refresh via Cron Job

If you want more control over when your product feeds are refreshed, outside of the plugin’s built-in scheduler, you can set up your own server-side cron job.

Step 1: Feed Configuration

To prevent the feed from running on its default refresh schedule, set the refresh interval to ‘No Refresh’ under the General tab of your feed settings.

Feed with No Refresh Refresh Interval

Step 2: Adding Cron Script

Create a PHP file that includes the logic to refresh your feed. Here’s an example script:

  • From the code, replace 123 with the correct feed ID.
  • Save this file inside your child theme’s directory (e.g., wp-content/themes/your-child-theme/feed-refresh-123.php).

You can get the feed ID by hovering over the feed name.

Step 3: Add Cron Job on Your Server

Now, configure your server to run the PHP script at your desired interval.

0 0 * * * php /path-to-wordpress/wp-content/themes/your-child-theme/feed-refresh-123.php >> /path-to-wordpress/wp-content/themes/your-child-theme/feed-refresh-log.txt 2>&1
  • Runs the script every day
  • Writes logs to feed-refresh-log.txt in the same directory

See this article if you’re a beginner in configuring CRON jobs.

Refreshing Multiple Feeds

To control multiple feeds:

  • Create a separate PHP file for each feed, each with its own feed ID
  • Create corresponding cron jobs for each file

Need Help?

If you need further assistance, don’t hesitate to reach out to our support team. We’re here to help ensure your feed is fully optimized and compliant.

If you are an existing customer, please go to the support ticket request form and send us a message.

If you are a free plugin user, please send us a support request on the forum. We actively monitor the WordPress.org support forums for the free plugin and help our users there as best as we can.

Was this article helpful?

Related Articles

Complete Your Purchase
AdTribes WooCommerce Product Feed

The best WooCommerce product feed plugin

  • AdTribes Pty Ltd
    ABN: 40 675 636 816