Skip to content

Commit 4647109

Browse files
author
Maxime CULEA
committed
loding admin classes only if admin classes
1 parent a5933b7 commit 4647109

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

members-post-type.php

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -140,31 +140,34 @@ function init_mpt_plugin() {
140140
new MPT_Shortcode();
141141
new MPT_Security();
142142

143-
// Class admin
144-
new MPT_Admin_Content_Permissions();
145-
new MPT_Admin_Main();
146-
new MPT_Admin_Post_Type();
147-
new MPT_Admin_Taxonomy();
148-
new MPT_Admin_Users_To_Members();
149-
new MPT_Admin_Welcome_Message();
150-
151-
/**
152-
* Handle import/export feature :
153-
* - mpt_admin_use_import
154-
* - mpt_admin_use_export
155-
* To deactivate feature, declare the hook in a mu-plugin to be before "plugins_loaded"
156-
*
157-
* @since 0.6.0
158-
* @author Maxime CULEA
159-
*/
160-
foreach( array( 'import', 'export' ) as $feature ) {
161-
if( ! apply_filters( 'mpt_admin_use_' . $feature, true ) ) {
162-
continue;
143+
if( is_admin() ) {
144+
145+
// Class admin
146+
new MPT_Admin_Content_Permissions();
147+
new MPT_Admin_Main();
148+
new MPT_Admin_Post_Type();
149+
new MPT_Admin_Taxonomy();
150+
new MPT_Admin_Users_To_Members();
151+
new MPT_Admin_Welcome_Message();
152+
153+
/**
154+
* Handle import/export feature :
155+
* - mpt_admin_use_import
156+
* - mpt_admin_use_export
157+
* To deactivate feature, declare the hook in a mu-plugin to be before "plugins_loaded"
158+
*
159+
* @since 0.6.0
160+
* @author Maxime CULEA
161+
*/
162+
foreach( array( 'import', 'export' ) as $feature ) {
163+
if( ! apply_filters( 'mpt_admin_use_' . $feature, true ) ) {
164+
continue;
165+
}
166+
_mpt_load_files( 'classes/admin/', array( $feature ), 'class-' );
167+
168+
$class = 'MPT_Admin_' . ucfirst( $feature );
169+
new $class;
163170
}
164-
_mpt_load_files( 'classes/admin/', array( $feature ), 'class-' );
165-
166-
$class = 'MPT_Admin_' . ucfirst( $feature );
167-
new $class;
168171
}
169172

170173
// Widget

0 commit comments

Comments
 (0)