[BUG] Call to undefined function get_home_path() in […]class-robots-txt.php:52
-
Meta
- WP: 5.7.2
- PHP:
PHP 7.3.27-1~deb10u1 (cli) (built: Feb 13 2021 16:31:40) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.27-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies
- Plugin: 3.0
The latest version caused our website to fail totally and displaying a white page with a link “How to trouble shoot wordpress”.
The servers logs show the following error message:
[Tue Jul 20 07:27:45.345625 2021] [php7:error] [pid 29562] [client 80.156.182.234:55883] PHP Fatal error: Uncaught Error: Call to undefined function get_home_path() in /srv/example.com/wp-content/plugins/uk-cookie-consent/includes/controllers/class-robots-txt.php:52\nStack trace:\n#0 /srv/example.com/wp-includes/class-wp-hook.php(292): termly\\Robots_Txt::check_file(Object(WP_Rewrite))\n#1 /srv/example.com/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array)\n#2 /srv/example.com/wp-includes/plugin.php(551): WP_Hook->do_action(Array)\n#3 /srv/example.com/wp-includes/class-wp-rewrite.php(1453): do_action_ref_array('generate_rewrit...', Array)\n#4 /srv/example.com/wp-includes/class-wp-rewrite.php(1483): WP_Rewrite->rewrite_rules()\n#5 /srv/example.com/wp-includes/class-wp-rewrite.php(1854): WP_Rewrite->wp_rewrite_rules()\n#6 /srv/example.com/wp-includes/class-wp-hook.php(292): WP_Rewrite->flush_rules(true)\n#7 /srv/example.com/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)\n#8 /srv/example.com/wp-includes/plugin.php( in /srv/example.com/wp-content/plugins/uk-cookie-consent/includes/controllers/class-robots-txt.php on line 52
I could “solve” the issue with replacing line 52 in
class-robots-txt.php
:$robots_path = \get_home_path() . '/robots.txt';
with
$robots_path = ABSPATH . '/robots.txt';
I followed this article:
https://riptutorial.com/wordpress/topic/9699/get-home-path–
Hope this helps in will be fixed in the next release of this plugin.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[BUG] Call to undefined function get_home_path() in […]class-robots-txt.php:52’ is closed to new replies.