Solution to PHP8 error
-
Hi, this is just a quick note for those having issues with the plugin not working with PHP8+, specifically with this error message:
An error of type E_ERROR was caused in line 1223 of the file /wp-content/plugins/youtube-channel-gallery/youtube-channel-gallery.php. Error message: Uncaught Error: Call to undefined function create_function() in /wp-content/plugins/youtube-channel-gallery/youtube-channel-gallery.php:1223
Simply replace that line of code with:
add_action( 'widgets_init', function() { register_widget( 'YoutubeChannelGallery_Widget' ); });
I’m not a big fan of editing plugin files directly but this should get the plugin working for now. The plugin has other code issues and it seems like it hasn’t been updated in a very long time, so I’d recommend looking for alternative solutions (not a good idea to use abandoned/unsupported plugins on production sites).
- The topic ‘Solution to PHP8 error’ is closed to new replies.