Created
September 10, 2019 06:15
-
-
Save elvismdev/9c5a87eba22be762b382e77e37fbf3ae to your computer and use it in GitHub Desktop.
Example `wpcfm_is_ssot` filter to conditionally set WP-CFM bundles files as SSOT when running on Pantheon live environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP-CFM SSOT | |
Description: Sets WP-CFM bundles as the Single Source of Truth. | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
/** | |
* Enable WP-CFM SSOT only for Pantheon Live environment. | |
* @param bool $is_ssot - default is false | |
* @return bool | |
*/ | |
function wp_lock_live_config( $is_ssot ) { | |
if ( defined( 'PANTHEON_ENVIRONMENT' ) && PANTHEON_ENVIRONMENT == 'live' ) { | |
return true; | |
} | |
return $is_ssot; | |
} | |
add_filter( 'wpcfm_is_ssot', 'wp_lock_live_config' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment