Skip to content

Instantly share code, notes, and snippets.

@ekka21
Created June 28, 2012 17:08
Show Gist options
  • Save ekka21/3012574 to your computer and use it in GitHub Desktop.
Save ekka21/3012574 to your computer and use it in GitHub Desktop.
Wordpress: Load core wordpress classes outside of wordpress
<?php
define( 'BLOCK_LOAD', true );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' );
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
<?php
define( 'BLOCK_LOAD', true );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' );
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment