Wordpress hack to make Flickr post drafts

I’m a Flickrite and I started using it to host pictures that I put up on my blog entries.

Unfortunately, there’s no way to have Flickr post the entries to my website as “Draft”. So I had to cook up a little hack for my xmlrpc.php file. Here it is in case you’re looking to do something similar with your Wordpress installation:

    function mw_newPost($args) {

      // … lines omitted, find this part:

      $post_author = $user_data->ID;

      $post_title = $content_struct['title'];
      $post_content = apply_filters( ‘content_save_pre’, $content_struct['description'] );
      $post_status = $publish ? ‘publish’ : ‘draft’;

      // Add the hack for Flickr here
      if (strpos($_SERVER['HTTP_USER_AGENT'], ‘Flickr’) >= 0) {
        $post_status = ‘draft’;
      }