WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Drafts Scheduler] If you want drafts in uncategorized to be ignored from scheduling…

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

    http://wordpress.org/extend/plugins/drafts-scheduler/

Viewing 1 replies (of 1 total)
  • Plugin Author Jeff Rose

    @talus

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Drafts Scheduler] If you want drafts in uncategorized to be ignored from scheduling…’ is closed to new replies.