Support » Plugin: Keyring Social Importers » [Feature Request: Import Status] Import tweets as drafts

  • Resolved agssl

    (@agssl)


    Hi,

    I’d love to select the post status of e.g. Tweets before I import them. I assume otherwise, I’ll have to modify every keyring importer and change the status from publish to draft, because I want to select only some relevant tweets, but not all of them. Or is there another easy way to change the status?

    Thanks,
    Achim

    • This topic was modified 2 years, 8 months ago by agssl.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Beau Lebens

    (@beaulebens)

    It might result in a (very) brief period when a post appears as published, but there’s an action fired after each post is imported, where you could hook in an switch posts back to being drafts.

    keyring_post_imported is the action, so you could do something like (NOT TESTED AT ALL!)

    
    add_action( 'keyring_post_imported', function( $post_id ) {
      wp_update_post( array( 'ID' => $post_id, 'post_status' => 'draft' ) );
    } );
    

    Which should fire right after a post is imported, and toggle it back to being a draft.

    • This reply was modified 2 years, 8 months ago by Beau Lebens.

    Awesome, thanks for the hint Beau. I tried your code, but got an internal error – a slightly modified version works like a charm. So, if anyone else needs it:

    add_action( 'keyring_post_imported', function( $post_id ) {
      $post = array(
        'ID'    => $post_id,
        'post_status' => 'draft',
      );
      wp_update_post( $post );
    } );
    Plugin Author Beau Lebens

    (@beaulebens)

    Cool! Glad it worked, and thanks for posting the actually-working version 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Feature Request: Import Status] Import tweets as drafts’ is closed to new replies.