WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. kythin
    Member
    Posted 2 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).

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

  2. Jeff Rose
    Member
    Plugin Author

    Posted 2 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

About this Topic