Permalink
Browse files

move wp admin to init with a conditional check on is_admin() + verify…

… class does not already exist to prevent errors with theme customizer in 3.4, fixes #15
  • Loading branch information...
benbalter committed Jun 15, 2012
1 parent 07e82fa commit 0349f8ebcf931f6b2731b42ae795b3191ce9ed45
Showing with 6 additions and 1 deletion.
  1. +6 −1 wp-document-revisions.php
@@ -50,7 +50,7 @@ function __construct() {
self::$instance = &$this;
//admin
- add_action( 'auth_redirect', array( &$this, 'admin_init' ) );
+ add_action( 'init', array( &$this, 'admin_init' ) );
add_action( 'init', array( &$this, 'i18n' ), 5 );
//CPT/CT
@@ -121,6 +121,11 @@ function i18n() {
* @since 0.5
*/
function admin_init() {
+
+ //only fire on admin + escape hatch to prevent fatal errors
+ if ( !is_admin() || class_exists( 'Document_Revisions_Admin' ) )
+ return;
+
include dirname( __FILE__ ) . '/includes/admin.php';
$this->admin = new Document_Revisions_Admin( self::$instance );
}

0 comments on commit 0349f8e

Please sign in to comment.