Media Explorer - Google Drive plugin for WordPress
PHP JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Media Explorer - Google Drive

This WordPress plugin adds support for Google Drive to the Media Explorer plugin.

This plugin was developed for the Hamilton-Wentworth District School Board Commons. Licensed under the GPLv2 or later.

Currently in pre-release status.


  1. Install the Media Explorer plugin.

  2. Install the Google Docs Shortcode plugin.

  3. Install the Shortcake plugin.

  4. If you plan on developing, clone this repo and run composer install in your shell prompt. This will install the latest version of Google's PHP API.
    If you plan on testing, head over to the Github Releases section for a precompiled .ZIP file of the entire plugin.

  5. Activate the plugin. You should now see a notice asking you to define some Google constants.

  6. For this, you will need to create a Google Drive application in Google Developers Console.

    1. Click on this link to create the app:
    2. For help filling in the application, read "Step 1" of this page:
    3. For your created app, enable oAuth 2.0.
      1. Under APIs & Auth > Credentials, click on Add credentials > OAuth 2.0 client ID.
      2. Under Create client ID, check Web application and click "Create".
      3. Under Name, type in an identifier of your choosing.
      4. Under Authorized Javascript origins, type in your site URL without a trailing slash. eg.
      5. Under Authorized redirect URIs, type in your site URL with a trailing slash. eg.
      6. Note down your Client ID and Client secret located at the top of this page.
  7. In wp-config.php or in a /wp-content/mu-plugins/ plugin, add the following:

  8. Finally, we are able to test the plugin! Either create a new post or edit an existing one and click on the "Add Media" button.

    • There should be a "Insert from Google Drive" link in the sidebar. Click on that.
    • You should now see a Sign-in to Google button. Once you've authenticated, you should be able to see your Google Drive contents and you should be able to start embedding.


  • You can view a walkthrough video showcasing the plugin's functionality on a WordPress multisite and BuddyPress instance.
  • This plugin was originally created so each user on a WordPress site could access their own Google Drive contents. If you plan on using this plugin in a shared, organizational context or would rather that the site share one Google Drive account, a developer should use:
  • the 'mexp_gdrive_get_refresh_token' filter to override how the token is fetched
  • the 'mexp_gdrive_update_refresh_token' action to update the token
  • the 'mexp_gdrive_delete_refresh_token' action to delete token
  • the 'mexp_gdrive_enable_user_profile_page' filter to return false