Forked from billerickson/be-disable-acf-frontend.php
Last active
September 17, 2020 07:27
-
-
Save leepeterson/a1195fd442f7295968cd042e66ea13c1 to your computer and use it in GitHub Desktop.
Revisions
-
Lee Peterson revised this gist
Oct 17, 2016 . 2 changed files with 40 additions and 26 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ <?php /** * Plugin Name: Disable ACF on Frontend * Description: Disable ACF functions on the front-end of WordPress in order to provide a performance boost. * Version: 2.0 * Author: Lee Peterson * Author URI: http://www.leepeterson.me * License: MIT * License URI: http://www.opensource.org/licenses/mit-license.php */ /** * Disable ACF on Frontend * * This is a forked and modified version of Bill Erickson's * Disable ACF Front-end (http://www.billerickson.net/code/disable-acf-frontend/). * It accounts for both free and premium versions of Advanced Custom Fields. */ function jc_acf_disable_frontend( $plugins ) { $acf_types = array(); if ( ! is_admin() ) { array_push( $acf_types, 'advanced-custom-fields/acf.php', // ACF Free Version 'advanced-custom-fields-pro/acf.php' // ACF Pro Version ); } foreach( $acf_types as $plugin ) { $key = array_search( $plugin, $plugins ); if( false !== $key ) { unset( $plugins[ $key ] ); } } return $plugins; } add_filter( 'option_active_plugins', 'jc_acf_disable_frontend' ); 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 charactersOriginal file line number Diff line number Diff line change @@ -1,26 +0,0 @@ -
billerickson renamed this gist
Aug 26, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
billerickson revised this gist
Aug 26, 2016 . 1 changed file with 14 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,23 @@ <?php /** * Plugin Name: Disable ACF on Frontend * Description: Provides a performance boost if ACF frontend functions aren't being used * Version: 1.0 * Author: Bill Erickson * Author URI: http://www.billerickson.net * License: MIT * License URI: http://www.opensource.org/licenses/mit-license.php */ /** * Disable ACF on Frontend * */ function ea_disable_acf_on_frontend( $plugins ) { if( is_admin() ) return $plugins; foreach( $plugins as $i => $plugin ) if( 'advanced-custom-fields-pro/acf.php' == $plugin ) unset( $plugins[$i] ); -
billerickson created this gist
Aug 26, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ <?php /** * Disable ACF on Frontend * */ function ea_disable_acf_on_frontend( $plugins ) { foreach( $plugins as $i => $plugin ) if( 'advanced-custom-fields-pro/acf.php' == $plugin ) unset( $plugins[$i] ); return $plugins; } add_filter( 'option_active_plugins', 'ea_disable_acf_on_frontend' );