forked from studio24/wordpress-multi-env-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-config.plugins.php
99 lines (72 loc) · 2.17 KB
/
wp-config.plugins.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* Deactivate Plugins based on environments
*
* WP_ENV needs to match environments defined in wp-config.env.php
*
* @package QuantumWP WordPress Multi-Environment Config
* @version 2.0.0
* @author Arleys Resco <[email protected]>
*/
$plugins = array();
/** Include Plugins Base */
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( defined( 'WP_ENV' )) {
switch ( WP_ENV ) {
case 'development' :
//-- Add Plugin Here: plugin_name/plugin_name.php
$plugins = array(
'google-analytics-dashboard-for-wp/gadwp.php',
);
//-- Disable Robots
update_option( 'blog_public', 0, true );
//-- Disable Change Admin Email
update_option( 'admin_email', '[email protected]', true );
//-- Change New Order Email Recipient
add_filter( 'woocommerce_email_recipient_new_order', 'dev_wc_change_admin_new_order_email_recipient', 1, 2 );
/**
* Change WooCommerce New Order Admin Email Programmatically
*
* @param $recipient
* @param $order
*
* @return string
*/
function dev_wc_change_admin_new_order_email_recipient( $recipient, $order ) {
global $woocommerce;
$recipient = "[email protected]";
return $recipient;
}
break;
case 'staging' :
//-- Add Plugin Here: plugin_name/plugin_name.php
$plugins = array(
'google-analytics-dashboard-for-wp/gadwp.php',
);
//-- Disable Robots
update_option( 'blog_public', 0, true );
//-- Disable Change Admin Email
update_option( 'admin_email', '[email protected]', true );
// Change new order email recipient for registered customers
add_filter( 'woocommerce_email_recipient_new_order', 'stg_wc_change_admin_new_order_email_recipient', 1, 2 );
/**
* Change WooCommerce New Order Admin Email Programatically
*
* @param $recipient
* @param $order
*
* @return string
*/
function stg_wc_change_admin_new_order_email_recipient( $recipient, $order ) {
global $woocommerce;
$recipient = "[email protected]";
return $recipient;
}
break;
case 'production' :
$plugins = array();
break;
}
}
/** Deactivate Selected Plugins */
deactivate_plugins( $plugins );