WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6

I suspect the cause is a custom widget that has been built incorrectly. Take a look at this example from the Codex: class My_Widget extends WP_Widget { /** * Sets up the widgets name etc */ public function __construct() { $widget_ops = array( ‘classname’ => ‘my_widget’, ‘description’ => ‘My Widget is awesome’, ); parent::__construct( ‘my_widget’, … Read more

Inject “fake” category to widget/block

Done like this: function cat_filter($args) { if (count($args) < 10) { return $args; } $new = new WP_Term((object)[ ‘term_id’ => -17, ‘name’ => ‘Blog’, ‘slug’ => ‘blog’, ‘taxonomy’ => ‘category’, ]); array_splice($args, -5, 0, [$new]); return $args; } add_filter(‘get_terms’, ‘cat_filter’, 10, 1); add_filter(‘term_link’, function( $url, $term, $taxonomy ) { if ( $term->term_id == -17 ) … Read more