Skip to content

Instantly share code, notes, and snippets.

@MaximeCulea
Last active June 23, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaximeCulea/e11139de89d6a1bbebb7f0ea556d5899 to your computer and use it in GitHub Desktop.
Save MaximeCulea/e11139de89d6a1bbebb7f0ea556d5899 to your computer and use it in GitHub Desktop.
Require ACF activation for a custom theme.
<?php
if ( ! function_exists( 'get_field' ) ) {
add_action( 'template_redirect', 'template_redirect_warning_missing_acf', 0 );
function template_redirect_warning_missing_acf() {
wp_die( sprintf( 'This theme can\'t work without ACF plugin. <a href="%s">Please login to admin</a>, and activate it !', wp_login_url() ) );
}
}
@MaximeCulea
Copy link
Author

Add php tags

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