YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.22k stars 403 forks source link

Customize check period #520

Closed baddate closed 1 year ago

baddate commented 1 year ago

Can I custom the check period? how?

YahnisElsts commented 1 year ago

You can pass a custom check period to the buildUpdateChecker method as the 4th argument, after the slug:

$myUpdateChecker = PucFactory::buildUpdateChecker(
    'https://example.com/path/to/details.json',
    __FILE__, //Full path to the main plugin file or functions.php.
    'unique-plugin-or-theme-slug',
    48 // <-- Check every 48 hours.
);

You could also set it to 0 to disable automatic update checks and then set up your own schedule (e.g. using a cron job) that calls $myUpdateChecker->checkForUpdates().

baddate commented 1 year ago

thanks! i got it.