Created
June 15, 2020 23:41
-
-
Save utkrishta/c9853a10e1b48111f829a3ee8e0b6080 to your computer and use it in GitHub Desktop.
Disable ACF on front end of the website
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 | |
/** | |
* Disable ACF on Frontend | |
*/ | |
function 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 ] ); | |
} | |
} | |
return $plugins; | |
} | |
add_filter( 'option_active_plugins', 'disable_acf_on_frontend' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The default ACF functions like "the_field();", "get_field();" won't work any-more.
Refer following on how to pull field values on front-end.
https://gist.github.com/utkrishta/97a2fa55bc25e2a973473dbf855f5cc4