Tagged: issues
-
AuthorPosts
-
July 28, 2022 at 7:12 pm #1359752
Today I have updated 5 Enfold sites from PHP 7.4 to PHP 8.0 without any problems. However, 1 website caused a problem (www.nataliewalters.nl) after updating to PHP 8.0 and I was not able to login at WordPress anymore. I got these errors:
WordPress versie 6.0.1
Actief thema: Enfold Child (versie 1.0)
Huidige plugin: (versie )
PHP versie 8.0.20Foutdetails
===========
Een fout van het type E_ERROR werd veroorzaakt op regelnummer 34 van het bestand /home/nataliefoto/domains/nataliewalters.nl/public_html/wp-content/themes/enfold-child/functions.php. Foutmelding: Uncaught Error: Undefined constant “‘after_setup_theme’” in /home/nataliefoto/domains/nataliewalters.nl/public_html/wp-content/themes/enfold-child/functions.php:34
Stack trace:
#0 /home/nataliefoto/domains/nataliewalters.nl/public_html/wp-settings.php(566): include()
#1 /home/nataliefoto/domains/nataliewalters.nl/public_html/wp-config.php(95): require_once(‘/home/nataliefo…’)
#2 /home/nataliefoto/domains/nataliewalters.nl/public_html/wp-load.php(50): require_once(‘/home/nataliefo…’)
#3 /home/nataliefoto/domains/nataliewalters.nl/public_html/wp-login.php(12): require(‘/home/nataliefo…’)
#4 {main}
thrownI use Enfold Child themes on all my Enfold sites. I have set the PHP version back to 7.4 now and that solved the issue, however I would like to upgrade to 8.0 of course. So what can be the problem here?
This is my functions.php file:
<?php /* * Add your own functions here. You can also copy some of the theme functions into this file. * WordPress will use those functions instead of the original functions then. */ function wpcodex_hide_email_shortcode( $atts , $content = null ) { if ( ! is_email( $content ) ) { return; } $content = antispambot( $content ); $email_link = sprintf( 'mailto:%s', $content ); return sprintf( '<a href="%s">%s</a>', esc_url( $email_link, array( 'mailto' ) ), esc_html( $content ) ); } add_shortcode( 'email', 'wpcodex_hide_email_shortcode' ); function ava_image_sizes() { remove_image_size(‘masonry’); remove_image_size(‘magazine’); remove_image_size(‘widget’); remove_image_size(‘featured’); remove_image_size(‘featured_large’); remove_image_size(‘extra_large’); remove_image_size(‘portfolio_small’); remove_image_size(‘gallery’); remove_image_size(‘entry_with_sidebar’); remove_image_size(‘entry_without_sidebar’); } add_action( ‘after_setup_theme’, ‘ava_image_sizes’, 11 );
Thank you for your help!
Best Wishes,
AlwinJuly 29, 2022 at 10:13 am #1359785Hi Alwin,
Can you try to replace all single quotes (just replace it manually).
If that does not help, try to replace after_setup_theme with initBest regards,
NikkoJuly 29, 2022 at 10:46 am #1359795Hello Niko,
I replaced all single quotes, that didn’t help.
What do you mean with “try to replace after_setup_theme with init”? Change this line:
add_action( ‘after_setup_theme’, ‘ava_image_sizes’, 11 );
into this:
add_action( ‘init’, ‘ava_image_sizes’, 11 );
?By the way, I use the exact some code in functions.php on 2 other Enfold sites which are running fine with PHP 8.0.
Thanks,
AlwinJuly 31, 2022 at 3:53 pm #1360004Hi Alwin,
I apologize for the delayed response.
Yes, that’s correct when I said replace after_setup_theme with init.Best regards,
NikkoAugust 2, 2022 at 9:36 pm #1360367Hello Niko,
Oke, I replaced the code like you said, but it does not solve the issue.
Best Wishes,
AlwinAugust 3, 2022 at 4:36 am #1360393Hi Alwin,
I tried the same thing on my end using WP 6.0.1 and the following PHP versions 8.0.7, 8.1.0, 7.4 and didn’t have any issue whether it’s after_setup_theme or init.
Can you try to switch your PHP version to 7.4 or 8.1? let us know if this helps.Best regards,
NikkoAugust 3, 2022 at 10:22 am #1360450PHP 7.4 is working fine, but that was not the issue (the website is running 7.4 by default).
The issue is that I like to upgrade this site to PHP 8.0. I have tried PHP 8.1 also now (like you asked me to try) but that is causing the same issue: the frontend is running fine, but I am not able to login at WordPress anymore.
B
Kind regards,
AlwinAugust 3, 2022 at 10:29 am #1360454Hi Alwin,
I apologize for the inconvenience.
Can we request for cPanel access? so we can check further on the issue as I can’t seem to replicate the issue you mentioned.Best regards,
NikkoAugust 3, 2022 at 10:54 am #1360457Hello Nikko,
The issue is solved! I misunderstood your very first suggestion to replace all single quotes…
I replaced the single quotes again, but now I did it the correct way and everything is working fine now :)
That leaves me with the question: how is it possible that there was no issue at PHP 7.4 with the wrong single quotes in the code?
Thanks,
AlwinAugust 3, 2022 at 11:05 am #1360459Hi Alwin,
That is also something I have not figured out :D
There are some people who are running PHP 7 who have that issue as well but get fixed with just manually replacing those wrong single quotes, so I just assumed that it does not work on certain servers but now I know it is true on certain PHP versions.
Anyway, I’m really glad that the issue is fixed on your end.Best regards,
NikkoAugust 3, 2022 at 12:42 pm #1360476Yes, thank you for your help Nikko!
best Wishes,
AlwinAugust 3, 2022 at 1:51 pm #1360491Hi,
Great, I’m glad that Nikko could help you out. Please let us know if you should need any further help on the topic, or if we can close it.
Best regards,
RikardAugust 3, 2022 at 5:31 pm #1360509You can close the topic Rikard, thanks :)
August 3, 2022 at 6:10 pm #1360517Hi,
Thanks for letting us know, I’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.
Best regards,
Rikard -
AuthorPosts
- The topic ‘Problem with PHP 8.0’ is closed to new replies.