[Plugin: Drafts Scheduler] If you want drafts in uncategorized to be ignored from scheduling…
-
I just wanted to post a quick patch I added to my copy of this wonderful plugin, so that I can leave drafts in ‘uncategorized’ and keep working on them until I save them to a different category and want them scheduled (i.e. they’re ‘finished’).
This patch may not work if you select more than one category along with ‘uncategorized’. Be aware you should backup your database first just incase, and know a little about PHP to do this.
1. open draft-scheduled.php, and find:
$thisDraft = array_pop( $draftList );
under that, add these two lines:
$pcat = get_the_category($thisDraft->ID); if (!($pcat[0]->slug == 'uncategorized')) {
then terminate the if statement you just added by adding a ‘}’ after the line:
check_and_publish_future_post( $thisDraft->ID );
2. This next change occurs in two places and it’s the same process for both. Find this foreach statement:
foreach ( $draftList as $thisDraft ){
Add this just inside the foreach:
$pcat = get_the_category($thisDraft->ID); if (!($pcat[0]->slug == 'uncategorized')) {
then terminate the if statement with a } just before the end of the same foreach block.
Congrats, you can now retain uncategorized drafts as drafts!
(backup your DB first, then try it to make sure you have it right. If it doesn’t work, you can then upload the db again).
- The topic ‘[Plugin: Drafts Scheduler] If you want drafts in uncategorized to be ignored from scheduling…’ is closed to new replies.