The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Drafts Scheduler
If you want drafts in uncategorized to be ignored from scheduling... (2 posts)

  1. kythin
    Posted 4 years ago #

    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).


  2. Jeff Rose
    Plugin Author

    Posted 4 years ago #

    Nice quick simple little hack. 'uncategorized' could really be any category I suppose.

    Thanks for sharing this. I'm glad you're liking the plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Drafts Scheduler
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic