Support

Account

Home Forums Front-end Issues ACF not installed on multisite?

Solving

ACF not installed on multisite?

  • Hello there. Forgive me if some of this seems rudimentary, but I’m not very well versed in the wordpress universe yet (and my php is very rusty).

    I’m working locally on my computer with a multisite installation and a lot, if not all, of the custom files for my install are namespaced. When I try and view a page on one of the sites, I get the following error:

    
    Fatal error: Uncaught Error: Call to undefined function Namespace\SubNamespace\get_field()
    in /site/app/public/wp-content/themes/site-theme/header.php on line 28
    
    Call stack:
    
    require_once()
      wp-includes/template.php:783
    load_template()
      wp-includes/template.php:718
    locate_template()
      wp-includes/general-template.php:48
    get_header()
      wp-content/themes/1stdibs-50/index.php:11
    include()
      wp-includes/template-loader.php:106
    require_once()
      wp-blog-header.php:19
    require()
      index.php:17
    Query Monitor
    

    Query Monitor is a plugin. When I disable this plugin, the site loads. As of right now, I cannot disable this plugin (maybe in the future once I understand the site structure better).

    When I go and view a different site, with the same include file, the that site loads fine.

    I read that this error can occur when the ACF plugin (we are using the Pro version) is not active. However, AFAICT, this is not the case in my install and the plugin is active.

    I’ve checked how files are loaded and it seems like the ACF settings file is loading before any other code that it needs on the FE.

    I’m really lost as to what may be the problem at this point as removing the namespace isn’t an option and it is working on our PROD site.

    What else can I try to resolve this locally?

    thanks in advance

  • I can’t really give you much guidance because I don’t know much about namespaces.

    I do know that ACF functions are defined in the global namespace.

    Your code appears to be trying to get a function some other defined namespace.

    
    function Namespace\SubNamespace\get_field()
    

    You’ll need to figure out why this is happening.

    Is there something that is telling PHP that all function calls should be in this namespace if none is specified?

  • Ya, that’s what I was noticing. In our setup, all of our custom files have this namespace. It seems like the “Query Monitor” plugin is messing up some sort of execution/load order. When I disable that plugin, the page loads fine.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.