• When seeking help with this issue, you may be asked for some of the following information:
    
    WordPress version 6.2
    
    Active theme: Duster (version 1.2)
    
    Current plugin: (version )
    
    PHP version 8.0.22
    
    Error Details
    
    =============
    
    An error of type E_ERROR was caused in line 167 of the file /home/grabir2/yearofthemite/wp-content/themes/duster/inc/widgets.php. Error message: Uncaught Error: Call to undefined function create_function() in /home/wp-content/themes/duster/inc/widgets.php:167
    
    Stack trace:
    
    #0 /home/wp-content/themes/duster/functions.php(393): require()
    
    #1 /home/wp-settings.php(591): include('/home/..')
    
    #2 /home/wp-config.php(118): require_once('/home/..')
    
    #3 /home/wp-load.php(50): require_once('/home/..')
    
    #4 /home/wp-admin/admin.php(34): require_once('/home/..')
    
    #5 /home/wp-admin/index.php(10): require_once('/home/..')
    
    #6 {main}
    
    thrown
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey there, thanks for the report! We’ll have a look and update you here.

    Hi @gigamacro. Duster is a retired theme, so it can’t be updated to support PHP8 in the themes directory, as the theme page is no longer available.

    However, I can guide you on how to update the theme yourself. This error is referencing the create_function function, which is deprecated in PHP8. All references to this need to be replaced with an anonymous function instead.

    Specifically, in /inc/widgets.php:

    add_action( 'widgets_init', create_function( '', "register_widget( 'Duster_Ephemera_Widget' );" ) );

    Should be replaced with:

    add_action( 'widgets_init', function() {
        return register_widget( 'Duster_Ephemera_Widget' );
    } );

    Hope this helps!

    Sarah @mikachan: Thank you for your help here. I implemented your suggested code change in widgets.php, and it worked briefly, then failed again. Any ideas on how to get this theme working again under PHP 8.1?

    Thank you!

    Hi @stacyconaway! Sorry to hear this stopped working in PHP 8.1. Could you please provide the exact error message you’re seeing this time?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP 8 breaks sites using Duster’ is closed to new replies.