{"id":41,"date":"2013-09-12T14:39:10","date_gmt":"2013-09-12T14:39:10","guid":{"rendered":"http:\/\/passionwind.com\/techref\/?p=41"},"modified":"2013-09-12T14:39:10","modified_gmt":"2013-09-12T14:39:10","slug":"how-to-fix-schedule-missed-error-on-wordpress-posts","status":"publish","type":"post","link":"http:\/\/techref.camellarry.com\/?p=41","title":{"rendered":"How to fix Schedule Missed error on WordPress posts"},"content":{"rendered":"<p>If you are experiencing then problem &#8220;scheduled missed&#8221; when scheduling a post in WordPress, I found the solution on\u00a0<a title=\"5ubliminal.com\" href=\"http:\/\/blog.5ubliminal.com\/\" target=\"_blank\">http:\/\/blog.5ubliminal.com\/<\/a>. \u00a0Simply do the following:<\/p>\n<ol>\n<li>Copy the code shown below and save it as\u00a0<strong>scheduled-mias.php<\/strong>.<\/li>\n<li>Upload the file to\u00a0<strong>wp-content\/plugins<\/strong>\u00a0on your WordPress site<\/li>\n<li>From your dashboard, enable the plugin named Scheduled Mias<\/li>\n<\/ol>\n<p>That&#8217;s all there is to it.<\/p>\n<hr \/>\n<p><span style=\"color: #0000ff;\">&lt;?php<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/*<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Plugin Name: [Post] Scheduled MIA-s<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Plugin URI: http:\/\/blog.5ubliminal.com\/topics\/wordpress\/plugins\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Description: Bring the left-for-dead &lt;code&gt;Missed Schedule&lt;\/code&gt; (MIA) posts back to life.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Version: 5.U.B<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Author: 5ubliminal<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Author URI: http:\/\/blog.5ubliminal.com\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Support URI: http:\/\/blog.5ubliminal.com\/support\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">*\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \/\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">define(&#8216;SCHEDULEDMIAS_DELAY&#8217;, 15); \/\/ Minutes .. change as you wish<\/span><\/p>\n<p><span style=\"color: #0000ff;\">define(&#8216;SCHEDULEDMIAS_TRANSIENT&#8217;, &#8216;scheduled_mias&#8217;); \/\/ Minutes .. change as you wish<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \/\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">class Schedules_MIAs{<\/span><\/p>\n<p><span style=\"color: #0000ff;\">public function Schedules_MIAs(){ $this-&gt;__construct(); }<\/span><\/p>\n<p><span style=\"color: #0000ff;\">public function __construct(){<\/span><\/p>\n<p><span style=\"color: #0000ff;\">add_action(&#8216;init&#8217;, array($this, &#8216;onInit&#8217;), 1);<\/span><\/p>\n<p><span style=\"color: #0000ff;\">}<\/span><\/p>\n<p><span style=\"color: #0000ff;\">public function onInit(){<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ I disable internal cron jobs for post publishing completely<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ &#8230; Comment the line below to let WordPress try do its job before we kick in<\/span><\/p>\n<p><span style=\"color: #0000ff;\">remove_action(&#8216;publish_future_post&#8217;, &#8216;check_and_publish_future_post&#8217;);<\/span><\/p>\n<p><span style=\"color: #0000ff;\">if(get_transient(SCHEDULEDMIAS_TRANSIENT)) return; \/\/ Make sure enough time elapsed since last run<\/span><\/p>\n<p><span style=\"color: #0000ff;\">set_transient(SCHEDULEDMIAS_TRANSIENT, 1, abs(intval(SCHEDULEDMIAS_DELAY)) * 60); \/\/ Reset delay<\/span><\/p>\n<p><span style=\"color: #0000ff;\">global $wpdb; \/\/ Global $wpdb object<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ Find MIA post_IDs, try both LOCAL datetime and GMT datetime<\/span><\/p>\n<p><span style=\"color: #0000ff;\">$scheduledIDs = $wpdb-&gt;get_col(<\/span><\/p>\n<p><span style=\"color: #0000ff;\">&#8220;SELECT `ID` FROM `{$wpdb-&gt;posts}` &#8220;.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">&#8220;WHERE ( &#8220;.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">&#8221; ((`post_date` &gt; 0 )&amp;&amp; (`post_date` &lt;= CURRENT_TIMESTAMP())) OR &#8220;.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">&#8221; ((`post_date_gmt` &gt; 0) &amp;&amp; (`post_date_gmt` &lt;= UTC_TIMESTAMP())) &#8220;.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">&#8220;) AND `post_status` = &#8216;future'&#8221;<\/span><\/p>\n<p><span style=\"color: #0000ff;\">);<\/span><\/p>\n<p><span style=\"color: #0000ff;\">if(!count($scheduledIDs)) return; \/\/ None found &#8230; bail<\/span><\/p>\n<p><span style=\"color: #0000ff;\">foreach($scheduledIDs as $scheduledID){<\/span><\/p>\n<p><span style=\"color: #0000ff;\">if(!$scheduledID) continue; \/\/ Just in case<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ Publish each post_ID the WordPress friendly way<\/span><\/p>\n<p><span style=\"color: #0000ff;\">wp_publish_post($scheduledID);<\/span><\/p>\n<p><span style=\"color: #0000ff;\">}<\/span><\/p>\n<p><span style=\"color: #0000ff;\">}<\/span><\/p>\n<p><span style=\"color: #0000ff;\">};<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \/\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">$Schedules_MIAs = new Schedules_MIAs();<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; \/\/<\/span><\/p>\n<p><span style=\"color: #0000ff;\">?&gt;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are experiencing then problem &#8220;scheduled missed&#8221; when scheduling a post in WordPress, I found the solution on\u00a0http:\/\/blog.5ubliminal.com\/. \u00a0Simply do the following: Copy the code shown below and save it as\u00a0scheduled-mias.php. Upload the file to\u00a0wp-content\/plugins\u00a0on your WordPress site From your dashboard, enable the plugin named Scheduled Mias That&#8217;s all there is to it. &lt;?php [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[89],"tags":[33,53,63,82],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-archived","tag-free","tag-plugin","tag-schedule","tag-wordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9t3oE-F","_links":{"self":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41"}],"version-history":[{"count":3,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":247,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions\/247"}],"wp:attachment":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}