I'm trying to define the constant ACF_Lite as true so that the interface of the Advanced Custom Fields plugin is hidden on all of my multisite subsites except the parent. For clarity and maintainability, I'm wanting to do this from an mu-plugins plugin that will also control the fields displayed by that plugin.

I thought this would do it but it didn't:

if( get_current_blog_id() !== 1 )
    define( 'ACF_Lite', true );

The plugin author says that this needs to be in wp-config.php, but I'm surprised that this doesn't work because, according to the codex, mu-plugins are:

Loaded by PHP, in alphabetical order, before normal plugins,

I've confirmed that get_current_blog_id() returns the right ID, so that's not the problem. I've also tried explicitly hooking that to muplugins_loaded and plugins_loaded but that has failed.

Can anyone explain why I can't define this from mu-plugins?

  • Put var_dump(defined('ACF_Lite')) in your mu-plugin. Is it already defined? – s_ha_dum Jun 6 '13 at 20:39
  • 1
    Should not be defined before the plugin is loaded, see source – fuxia Jun 6 '13 at 20:40
  • The answer below solved my issue, but I want to make sure I understand @toscho's comment (upvote and all!). It seems to me that the whole point is to define the constant before the plugin is loaded so it doesn't display the UI. – mrwweb Jun 6 '13 at 22:58
  • @mrwweb I just pointed out the order was correct, didn’t see the lower case. :) – fuxia Jun 7 '13 at 6:29

@toscho's link solved this. PHP constants are case sensitive.

ACF uses ACF_LITE, you are using ACF_Lite.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.