WordPress.org

Support

Support » How-To and Troubleshooting » Schedule Posts Not Working in 2.5

Schedule Posts Not Working in 2.5

  • I upgraded to 2.5 – everything went well, except for two of my most favorite plug-ins crapping out (Image Manager and PodPress). however, I noticed this morning that the publish date and time is not working correctly.

    When I click the edit button and change the time, then click save or publish, the post gets published at the current date and time and not in the future.

    I have disabled all plug-ins and it still does not work.

    Any help would be greatly appreciated as being able to properly schedule a post is vital for my website.

Viewing 15 replies - 46 through 60 (of 99 total)
  • Can anyone please advise where the new php file goes or what I can tell my host to get the compatibility issues fixed?

    Thanks

    I just edited my /wp-includes/cron.php file and it worked.

    –Branson

    Scheduling an update to an existing post also seems to cause this issue. One would have to manually change the setting from “Scheduled” to “Post” for each individual blog post.

    I attempted to use the mySQL code from a previous reply to this thread, however, it didn’t work.

    How can I disable scheduled posting altogether?

    After some digging around, I came upon something that appears to work.

    Executing the below mySQL command will force “future” or “scheduled” posts to become “published” posts:
    UPDATE wp_posts SET post_status = 'publish';

    I took my cue from reading a nice article on Perishable Press that pertained to using mySQL statements to turn “on” and “off” comments.

    I would imagine that this mySQL code can be placed in a .PHP file, and can be executed with a Cron Job for timed and future posting. Would anyone care to come up with the .PHP code? 🙂

    I’m sure there’s more that can be done, so I recommend reading that Perishable Press article. Remember, your mileage might vary with this code.

    a simple code fix would be great!

    after speaking with bluehost they said that the initial wordpress installation (i used fantastico) didn’t set up a cron job for scheduling future dated posts.

    does anyone know what the cron job should be and how to do that part of the installation?

    Same exact problem here, 2.6.1 doesn’t fix it yet.

    Posts appear as scheduled and don’t go online after the specified time for publishing.

    Sucks!

    one of the moderators said that a cron job needs to be set up to tell the posts to post but i have no idea how to set that up or what should be in it. does anyone else know?

    bumping

    I’m running WordPress 2.6.1 on IIS. I don’t have cron, but I can set up scheduled tasks through my control panel. That and the changes below, gleaned from the posts above, worked for me. However, since scheduled tasks on my hositng account can be no less than hourly, that’s how often the posts can appear, regardless of the specific time they are scheduled. A minor inconvenience.

    in /wp-includes/cron.php

    REPLACED:

    $argyle = @ fsockopen( $parts[‘host’], $_SERVER[‘SERVER_PORT’], $errno, $errstr, 0.01 );
    if ( $argyle )
    fputs( $argyle,
    “GET {$parts[‘path’]}?check=” . md5(DB_PASS . ‘187425’) . ” HTTP/1.0\r\n”
    . “Host: {$_SERVER[‘HTTP_HOST’]}\r\n\r\n”
    );
    }

    WITH:

    if ( $argyle ){
    fputs( $argyle,
    “GET {$parts[‘path’]}?check=” . wp_hash(‘187425’) . ” HTTP/1.0\r\n”
    . “Host: {$_SERVER[‘HTTP_HOST’]}\r\n\r\n” );
    fflush($argyle);
    fgets($argyle);
    fclose($argyle);
    }
    }

    in /wp-cron.php

    REMOVED:

    if ( $_GET[‘check’] != wp_hash(‘187425’) )
    exit;

    [b]in control panel[/b]

    Set up scheduled task in control panel for /wp-cron.php.

    I don’t have a cron.php file in wp-includes

    Can someone please post the full code of the cron.php file (not just the changed bits as I don’t have a cron file)

    Thanks!!

    Ok guys, so here’s what I did to fix this problem. It’s honestly more of a rig, since I just recently starting moding wordpress.

    – Backup your old wp-cron.php

    make this your new wp-cron.php

    <?php
    require_once('./wp-config.php');
    
    		$db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    		mysql_select_db(DB_NAME, $db);
    		$myQuery = "SELECT * FROM <code>wp_posts</code> WHERE <code>post_status</code>='future';";
    		$results = mysql_query($myQuery, $db) or die(mysql_error());
    		while($get = mysql_fetch_array($results, MYSQL_BOTH))
    			{
    				$pID		=	$get['ID'];
    				$pDATE		=	$get['post_date_gmt'];
    				$tNow		=	gmdate('Y-m-d H:i:s');
    				$tSET		=	$get['post_status'];
    				if($tNow>$pDATE)
    					{
    						$doPOST = 'PUBLISH!';
    						$doQuery = "UPDATE <code>wp_posts</code> SET <code>post_status</code> = replace(<code>post_status</code>,'future','publish') WHERE <code>ID</code>='$pID'";
    						mysql_query($doQuery);
    					}
    			}
    ?>

    Then I inserted this into my wp-content/themes/theme-name/header.php
    That way a check takes place every time a page is viewed to see if scheduled posts ought to be published.

    require_once(ABSPATH.'wp-cron.php');

    Again, really rough.. but I hope it can serve as a starting point.

    Michael

    PS. Because I’m a nub, you may have to tweak around with the SQL Statement, since the tilde key serves as a markup tag, and I don’t know how to make it show up right 😛

    Hi Michael thanks for your help

    Where do you put the require_once etc etc in the header.php? Can it go anywhere or should it be somewhere specific?

    I can’t remember, since I was working on it at work, and I’m at home now. 😛 I put it in there before anything important happens. The idea is that posts are set to publish before the user sees them. It’s sort of a pseudo-cron job, since it’s not really relying on chronological cycles but rather page views. If I recall I think it was probably the first thing I dropped into the header.

    Let me know if you can’t figure it out, and I’ll take a closer look at it.

    Michael

    ok will give it a go tonight and cross my fingers!

Viewing 15 replies - 46 through 60 (of 99 total)
  • The topic ‘Schedule Posts Not Working in 2.5’ is closed to new replies.
Skip to toolbar