WP problem with media upload

Hi all,

I made a clean wordpress installation and uploaded a default ttg wordpress template theme.
I have the problem that uploaded image files are displayed in the grid view, but not in the list view which shows:

There has been a critical error on this website. Please check your site admin email inbox for instructions

  • see attached screenshots.
    With the twenty twenty template everything works fine.



The following might help:

[11-Mar-2023 14:48:04 UTC] PHP Fatal error: Uncaught Error: Undefined constant “is_admin” in /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-content/themes/wordpress/inc/theme_posts.php:145
Stack trace:
#0 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/class-wp-hook.php(310): mod_gallery_image_attributes()
#1 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/media.php(1095): apply_filters()
#3 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-media-list-table.php(428): wp_get_attachment_image()
#4 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1527): WP_Media_List_Table->column_title()
#5 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-media-list-table.php(699): WP_List_Table->single_row_columns()
#6 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1444): WP_Media_List_Table->display_rows()
#7 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1371): WP_List_Table->display_rows_or_placeholder()
#8 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/upload.php(388): WP_List_Table->display()
#9 {main}
thrown in /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-content/themes/wordpress/inc/theme_posts.php on line 145
[11-Mar-2023 14:48:11 UTC] PHP Fatal error: Uncaught Error: Undefined constant “is_admin” in /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-content/themes/wordpress/inc/theme_posts.php:145
Stack trace:
#0 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/class-wp-hook.php(310): mod_gallery_image_attributes()
#1 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/media.php(1095): apply_filters()
#3 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-media-list-table.php(428): wp_get_attachment_image()
#4 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1527): WP_Media_List_Table->column_title()
#5 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-media-list-table.php(699): WP_List_Table->single_row_columns()
#6 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1444): WP_Media_List_Table->display_rows()
#7 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1371): WP_List_Table->display_rows_or_placeholder()
#8 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/upload.php(388): WP_List_Table->display()
#9 {main}
thrown in /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-content/themes/wordpress/inc/theme_posts.php on line 145

What can I do?

Thx in advance.

Best regards,
Oliver

in WP recovery mode I receive the message:

This theme failed to load properly and was paused within the admin backend.

I received the following email:

Howdy!

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

In this case, WordPress caught an error with your theme, Wpblog.

First, visit your website (Der Sculptureclub – Blog) and check for any visible issues. Next, visit the page where the error was caught (https://www.sculptureclub.de/blog/blog/wp-admin/upload.php) and check for any visible issues.

Please contact your host for assistance with investigating this issue further.

If your site appears broken and you can’t access your dashboard normally, WordPress now has a special “recovery mode”. This lets you safely login to your dashboard and investigate further.

https://www.sculptureclub.de/blog/wp-login.php?action=enter_recovery_mode&rm_token=g25k7BVCdjdSkKmhXCKUoD&rm_key=11lUjWa9DZOMVJxYI7VoB1

To keep your site safe, this link will expire in 1 day. Don’t worry about that, though: a new link will be emailed to you if the error occurs again after it expires.

When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.1.1
Active theme: Wpblog (version 1.2.0)
Current plugin: (version )
PHP version 8.0.27

Error Details

An error of type E_ERROR was caused in line 145 of the file /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-content/themes/wpblog/inc/theme_posts.php. Error message: Uncaught Error: Undefined constant “is_admin” in /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-content/themes/wpblog/inc/theme_posts.php:145
Stack trace:
#0 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/class-wp-hook.php(310): mod_gallery_image_attributes()
#1 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-includes/media.php(1095): apply_filters()
#3 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-media-list-table.php(428): wp_get_attachment_image()
#4 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1527): WP_Media_List_Table->column_title()
#5 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-media-list-table.php(699): WP_List_Table->single_row_columns()
#6 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1444): WP_Media_List_Table->display_rows()
#7 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/includes/class-wp-list-table.php(1371): WP_List_Table->display_rows_or_placeholder()
#8 /mnt/web508/c1/11/510207511/htdocs/sculptureclub.com/blog/wp-admin/upload.php(388): WP_List_Table->display()
#9 {main}
thrown

Any help is appreciated

Thx in advance,
Oliver

Is your Backlight installation up to date? According to a post by @ben (PHP 8 and Wordpress - #8 by Ben), the is_admin error has been fixed a while ago. Check his link for a possible workaround.

Thank you Daniel,

if (is_admin()) { solved it!
:+1:

Best regards,
Oliver

1 Like