We're suddenly getting these errors in some of our page templates:

mod_fcgid: stderr: PHP Fatal error:  Uncaught TypeError: call_user_func_array(): 
Argument #1 ($callback) must be a valid callback, function "viewport_meta" 
not found or invalid function name in 
/home/domain.com/wp-includes/class-wp-hook.php:308, referer: https://domain.com/en/

The wp-includes is core Wordpress, so I'm not sure what this is about. The other lines around this error log line are all about the referer, which is often the page just before this one.. it could be any page. So I wonder if the class-wp-hook.php is somehow being called in the page template specific to this page. But there's nothing all that special in this page template that's not also in other pages that do work.

Only this one gives the dreaded

There has been a critical error on this website.
Learn more about troubleshooting WordPress.

Any pointers?

  • 1
    The cause of this error is always the same, so searching would help find the answer. The cause is that somewhere in your code you have an add_filter() or add_action() where the second argument is 'viewport_meta', but a function with that name doesn't exist. Mar 2 at 3:28
  • Adding to Jacob's comment - either the callback function doesn't exist or it does, but it's being referenced without a required namespace.
    – vancoder
    Mar 2 at 19:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.