Skip to content

Instantly share code, notes, and snippets.

@elvismdev
Created September 10, 2019 06:15
Show Gist options
  • Save elvismdev/9c5a87eba22be762b382e77e37fbf3ae to your computer and use it in GitHub Desktop.
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.
<?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