• Resolved hawkeye126

    (@hawkeye126)


    I have a correctly formatted php functions file in my mu-plugins/ directory.
    When trying to use wp_is_mobile() or current_user_can(), I get an undefined function error.

    Fatal error: Call to undefined function wp_is_mobile() in /var/www/dev.example.com/public/wp-content/mu-plugins/multisite-functions.php on line 147

    Are certain core functions defined after the mu-plugins?
    How do I fix or avoid this?
    Can I simply not use certain functions in mu plugins?

    Thank you!

Viewing 1 replies (of 1 total)
  • Thread Starter hawkeye126

    (@hawkeye126)

    Thanks to diggy from StackOverflow I’ve foudn that in the WordPress cycle, the file vars.php (containing my needed functions) is included after muplugins_loaded executes.

    Including wp_is_mobile() and current_user_can() in wrapper functions fixed my problem.

    I am posting here for future reference, hopefully someone will find it useful.

Viewing 1 replies (of 1 total)
  • The topic ‘Certain functions are undefined when called form mu-plugins folder’ is closed to new replies.