Skip to content

Instantly share code, notes, and snippets.

@lknight
Created August 2, 2013 12:43
Show Gist options
  • Save lknight/6139600 to your computer and use it in GitHub Desktop.
Save lknight/6139600 to your computer and use it in GitHub Desktop.
Plugin for wordpress to
<?php
/**
Plugin Name: DW RDS_DB object
Description: provides special object $wp_rds_db access external database
Plugin URI: http://pvp.alvegia.ru
Author: Pavel G. Roytberg
Author URI: http://onga.ru
Version: 0.1
USAGE: just declare $global $wp_rds_db and use it with all the wordpress class wpdb has to offer.
*/
//IT RUNS EVERY LOADED PAGE. SO PROVIDE THIS INSTANCE OF WPDB CLASS TO THE WHOLE WORDPRESS.
define('DB_RDS_NAME','DB_NAME');
define('DB_RDS_USER','USER');
define('DB_RDS_PASSWORD','pass!word');
define('DB_RDS_HOST','instancename.secret-salt.zone-name.rds.amazonaws.com');
$wp_rds_db = new wpdb( DB_RDS_USER, DB_RDS_PASSWORD, DB_RDS_NAME, DB_RDS_HOST);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment