This plugin is a fork of the Scheduled Post Trigger plugin, modified for slight performance improvement and suppose for a check interval. Please feel free to suggest further performance improvements.
🚨 If your site does not support object caching, you will not likely observe any sort of performance benefit over the original plugin, since WordPress will fall back to caching in the database (incurring a penalty). If you're not sure, you can check your wp-content
directory for the presence of a file named object-cache.php
.
By default, this plugin will check for missed scheduled posts every 60 seconds. You can change this by modifying the plugin, or defining the TSP_CHECK_INTERVAL
constant to a different interval in your site's wp-config.php
. Example:
define( 'TSP_CHECK_INTERVAL', 300 ); // Every 5 minutes
Yes, I'm aware that I could have simply appended get_current_blog_id()
to the cache key, but I figured that checking for a constant first was leaner.
- Create a file named
trigger-scheduled-posts.php
in yourwp-content/plugins
directory. - Paste the code below and save.
- Activate the Scheduled Post Trigger plugin in WP Admin.
This plugin does not make any changes to your WordPress installation, so if you no longer want to use it, simply delete the plugin.
this sql works for me
SELECT ID FROM $wpdb->posts WHERE post_status = 'future' AND (post_date_gmt < UTC_TIMESTAMP() || post_date < NOW())