Skip to content

Instantly share code, notes, and snippets.

@krusynth
Created June 7, 2015 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krusynth/a2a711c941123beee296 to your computer and use it in GitHub Desktop.
Save krusynth/a2a711c941123beee296 to your computer and use it in GitHub Desktop.
Use Wordpress login system on a custom PHP page.
/**
* Example of php code using Wordpress' login.
*/
require_once '../pages/wp-blog-header.php';
// If the user is not authorized, redirect to the Wordpress login.
auth_redirect();
// Your code here
// You must set the following values in your wp-config file.
// Your domain name.
define('WP_HOME', 'http://pltrust.dev.krues8dr.com/' );
// Path to wordpress. Leave this as an empty string if you've installed
// it in the root.
define('WP_SITEURL', WP_HOME . 'wordpress' );
// The root path. This needs to be a level that includes both the custom
// PHP page and Wordpress itself.
define( 'COOKIEPATH', '/' );
define( 'SITECOOKIEPATH', COOKIEPATH );
define('ADMIN_COOKIE_PATH', COOKIEPATH);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment