michaelhartmayer
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Schedule Posts Not Working in 2.5I 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
Forum: Fixing WordPress
In reply to: Schedule Posts Not Working in 2.5Ok 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 ??