Google Drive for WordPress

The integration of Google Drive for WordPress offers some great features.  A plugin for WordPress called docs to WP connects Google Drive to WordPress, allowing a person to create post and edit posts on a Google Drive account.

If you’ve never used Google Drive or its predecessor, Google Docs, I’ll describe it for you.

Image representing Google Docs as depicted in ...

Drive is like have an online, private disk drive that holds 5 Gigabytes of date. Various online applications allow you to do wordprocessing, spreadsheets, presentation slides, drawings and so on.

It allows an author to access work from just about any computer, pad or smartphone with an internet connection. The files can also be shared with others in order to do collaborations. I think it is a better way to author work that to use the WordPress editor. I like to collect a pile of source documents and URLs related to what I write.

I also like to upload my stuff into WordPress where I can run the SEO optimization tools along with content enhancers like Zemanta. This allows me to put up stories from anywhere on the web.

I have found that images I insert into a Google Drive document do not make it onto the WordPress site. The need to be added separately once the text is uploaded.

The way my set up works is that I write my copy in one of several folders. When I am ready to upload it to WordPress, I just move it to a folder I named SendToWP.  Any folder name can be used as this is part of the configuration you add to wp_config.php. WordPress queries my folder once per minute at Google. If it finds a new file, that file is uploaded as a WordPress post without any intervention on my part. The Google Drive file is then moved to the Done directory. I find that useful.

This facility is one of a number of pieces that are useful to make WordPress more useful to news gathering people. But software like this tends to be used far beyond its original intended use. My hat is off to William P. Davis and his employer Bangor Daily News.

Technical Details:

The way the plugin works is that you install the plugin with the WordPress plugin installer. The plugin is at Then you need to put some configuration text into your wp_config.php file. The updates to wp_config.php are shown at

Screen Shot of plugin admin pageWhen I installed the plugin package docs-to-wordpress by using the plugin installer,it installed 3 plugins. The plugins include docs-to-WP, Docs to WordPress extender – Run on Cron, Docs to WordPress extender – clean content, strip comments.

I also added some code to the file docs-to-wordpress/extend-clean.php via the plugin editor.

This code allows you to put a Title in the text of the Google Drive file. You just need to put it first in the text and follow the titel with a pipe symbol, usually shfit+ on the keyboard. This code is is taken from the plugin author’s William Davis’s site,

/**** added code  ****/


Plugin Name: Extend Docs to WP like so



add_filter( ‘pre_docs_to_wp_insert’, ‘bdn_split_post’ );

function bdn_split_post( $post_array = array() ) {


$exploded_fields = explode( ‘|’, $post_array[ ‘post_content’ ] );

//Sometimes people forget a pipe, and we don’t want to put the entire post in the headline

if( is_array( $exploded_fields ) && count( $exploded_fields ) >= 2 ) {


//Save the old title in case you want to do something with it

$old_title = $post_array[ ‘post_title’ ];


//Set the title to the first occurance.

$post_array[ ‘post_title’ ] = strip_tags( $exploded_fields[ 0 ] );

//Unset the title

unset( $exploded_fields[ 0 ] );

//Now restore the post content and save it

$post_array[ ‘post_content’ ] = implode( ‘|’, $exploded_fields );



return $post_array;



/**** end of added code ****/

There are a number of other pieces that need to be integrated in order to produce what  believe is a truly great piece of software for professional newsrooms. I’ll talk about those in future posts.

This entry was posted in Articles, Technology and tagged , , , , , , , , , . Bookmark the permalink.