Wordpress error
Hi,
I received this email from wordpress:
First, go to your website (https://otbioelettronica.it/) and check if there are any visible problems. Next, go to the page where the error was found (https://otbioelettronica.it/wp-admin/customize.php?theme=betheme-child&return=https%3A%2F%2Fotbioelettronica.it%2Fwp-admin%2Fthemes.php) and check if there is any visible problem.
Please contact your host for assistance in further investigating this issue.
If your site appears corrupted and you can't access your dashboard normally, WordPress now has a special "recovery mode". This allows you to securely log into your dashboard to check what's wrong.
To keep your site safe, this link will expire in 1 day. Don't worry about that - a new link will be sent to you if the error occurs again after the deadline.
If you seek help with this issue, you may be asked for some of the following information:
WordPress version 6.2.2
Active theme: Betheme Child (version 1.0)
Current plugin: (version )
PHP version 7.4.33
Details of the error
====================
An error of E_ERROR was caused in line 220 of the file /data/sites/web/otbioelettronicait/www/wp-content/themes/betheme/functions.php. Error Message: Cannot redeclare fix_rewritebase() (previously declared in /data/sites/web/otbioelettronicait/www/wp-content/themes/betheme-child/functions.php:9)
I had to add this piece of code because there was a language issue that crashed the site and WPML support told me to add this (in functions.php):
add_filter('mod_rewrite_rules', 'fix_rewritebase');
function
fix_rewritebase($rules){
$home_root
= parse_url(home_url());
if
( isset( $home_root['path'] ) ) {
$home_root
= trailingslashit($home_root['path']);
} else
{
$home_root
= '/';
}
$wpml_root
= parse_url(get_option('home'));
if
( isset( $wpml_root['path'] ) ) {
$wpml_root
= trailingslashit($wpml_root['path']);
} else
{
$wpml_root
= '/';
}
$rules
= str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);
$rules
= str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);
return
$rules;
}
Can this give problems with your theme?
Best regards
Davide
Comments
Hi,
Yes, this code might give problems.
If you get it from the WPML it would be best if you contact them regarding this because they know best what it does, and should be able to correct it.
Best regards
Hi,
They told me to use this code, isn't that okay?
I do not know what exactly this code is for.
It would be best if you contact their support regarding this.
Best regards