Hi @mapdi,
I have tested that the current version of the plugin runs on PHP 8 without producing any errors.
If you are receiving a problem after upgrading, then it is likely due to the code in one of your snippets. Consider enabling safe mode and seeing whether that lets you login to your site.
Thread Starter
mapdi
(@mapdi)
Hi @bungeshea,
Thank you very much for your reply.
You were right. I had deactivated the Search Feature in WordPress.
This caused the issue:
function wpb_filter_query( $query, $error = true ) {
if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
if ( $error == true )
$query->is_404 = true;
}
}
add_action( 'parse_query', 'wpb_filter_query' );
add_filter( 'get_search_form', create_function( '$a', "return null;" ) );
function remove_search_widget() {
unregister_widget('WP_Widget_Search');
}
add_action( 'widgets_init', 'remove_search_widget' );
Thanks!
Best regards!
Hi @mapdi,
The problem with your code is the use of create_function – in newer versions of PHP you should be using anonymous functions instead.
Here’s an updated version of that code:
add_action( 'parse_query', function ( $query, $error = true ) {
if ( is_search() ) {
$query->is_search = false;
$query->query_vars['s'] = false;
$query->query['s'] = false;
if ( $error ) {
$query->is_404 = true;
}
}
} );
add_filter( 'get_search_form', '__return_null' );
add_action( 'widgets_init', function () {
unregister_widget( 'WP_Widget_Search' );
} );