500 error after upgrading from 5.0 to 5.4 and adding empty functions.php

I've finally managed to upgrade a WP site from v5.0 to v5.4. The only issue left is when I create an empty function

I've finally managed to upgrade a WP site from v5.0 to v5.4. The only issue left is when I create an empty functions.php file I get 500 error.

Does someone have an idea why is that? Thanks.

Update: My goal is to place the following into functions.php:

function my_acf_init() {
  acf_update_setting('google_api_key', $_ENV['GOOGLE_MAPS_API_KEY']);
}

add_action('acf/init', 'my_acf_init');

I've finally managed to upgrade a WP site from v5.0 to v5.4. The only issue left is when I create an empty functions.php file I get 500 error.

Does someone have an idea why is that? Thanks.

Update: My goal is to place the following into functions.php:

function my_acf_init() {
  acf_update_setting('google_api_key', $_ENV['GOOGLE_MAPS_API_KEY']);
}

add_action('acf/init', 'my_acf_init');
Share Improve this question edited Jul 8, 2020 at 9:12 haxpanel asked Jul 7, 2020 at 17:00 haxpanelhaxpanel 15710 bronze badges 6
  • 1 So there was no functions file before and now there is a blank file? Is the functions file at least a valid PHP file? <?php as the first line. – jdm2112 Commented Jul 7, 2020 at 17:06
  • 1 Why do you need to do that if it creates an error? – mozboz Commented Jul 7, 2020 at 17:21
  • 1 500 errors are just Apache/Nginx's way of saying something in PHP went wrong. Look at the PHP error log for the actual error message – Tom J Nowell Commented Jul 7, 2020 at 17:27
  • @jdm2112 My goal isn't to add an empty functions.php obviously. I have gradually removed its content to see where it breaks. I wanna add an add_action call to inject env variable value to Advanced Custom Fields. – haxpanel Commented Jul 8, 2020 at 9:02
  • 1 Removing code in pieces to find the offending section is not very efficient. If you are actively developing this site the PHP log is your friend. I have no experience with Heroku but this might help: devcenter.heroku/articles/php-logging – jdm2112 Commented Jul 8, 2020 at 18:03
 |  Show 1 more comment

1 Answer 1

Reset to default 0

I've managed to print the error message by adding the following to the functions.php:

function exception_handler($exception) {
    echo "Uncaught exception: " , $exception->getMessage(), "\n";
}

set_exception_handler('exception_handler');

For some reason logs did not include the error details before. The error is call to undefined function is_blog_installed() which I have no idea why's that. :D

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742266869a4411961.html

相关推荐

  • 500 error after upgrading from 5.0 to 5.4 and adding empty functions.php

    I've finally managed to upgrade a WP site from v5.0 to v5.4. The only issue left is when I create an empty function

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信