Trying to update a WordPress site from PHP7.4 to 8.1 and I am getting these errors
Fatal error: Uncaught Error: Attempt to assign property "posts" on null in TEMPLATEFILE on line 93
Line 93
$query_txt_ref->posts = array();
Line 98
$query_book->posts = array();
Line 224
$query_txt_ref_others->posts = array();
Line 232
$query_others->posts = array();
Was working in 7.4 but not sure how to go about changing it. Would anyone be able to give me pointers on how to change this?
Here's a few more lines for reference.
add_filter('posts_where', 'where_text_refrence');
add_filter('posts_join','join_text_refrence');
$query_txt_ref->posts = array();
$query_txt_ref = new WP_Query($args_daily_devotion_txt_ref);
remove_filter('posts_where', 'where_text_refrence');
remove_filter('posts_join', 'join_text_refrence');
$query_book->posts = array();
add_filter('posts_where', 'where_botb_tags');
$query_book = new WP_Query($args_daily_devotion);
remove_filter('posts_where', 'where_botb_tags');