Skip to content

Instantly share code, notes, and snippets.

@utkrishta
Created June 15, 2020 23:41
Show Gist options
  • Save utkrishta/c9853a10e1b48111f829a3ee8e0b6080 to your computer and use it in GitHub Desktop.
Save utkrishta/c9853a10e1b48111f829a3ee8e0b6080 to your computer and use it in GitHub Desktop.
Disable ACF on front end of the website
<?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' );
?>
@utkrishta
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment