Created
May 10, 2018 21:50
-
-
Save craigsimps/8f276b92e80180f047cfb79932ac3ea9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| add_filter( 'option_active_plugins', __NAMESPACE__ . '\disable_acf_on_frontend' ); | |
| /** | |
| * Disable ACF Pro on website frontend. | |
| * | |
| * Provides a performance boost if ACF frontend functions aren't being used. | |
| * | |
| * @since 1.0.0 | |
| * @link https://www.billerickson.net/code/disable-acf-frontend/ | |
| * | |
| */ | |
| function disable_acf_on_frontend( $plugins ) { | |
| if ( is_admin() ) { | |
| return $plugins; | |
| } | |
| foreach ( $plugins as $index => $plugin ) { | |
| if ( 'advanced-custom-fields-pro/acf.php' == $plugin ) { | |
| unset( $plugins[ $index ] ); | |
| } | |
| } | |
| return $plugins; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment