## wp query – XML WP_Query problem in PHP 8.0 and 8.1

Question

I have a strange problem. In PHP 7.4 script for generating XML for other comparison site worked well, but after upgrading PHP to 8.0 it doesn’t work anymore.
In sandbox i got these:

Stack trace:
#0 {main}
thrown in /home/user/scripts/code.php on line 78

and the code in line 78 looks like this (last line with WP_query):

$args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’ ); if( count($config['exclude-products'] ) ) {
$args['post__not_in'] =$config['exclude-products'];
}

// PRODUCT LIMIT (1 product can have multiple variations)
if( isset( $_GET['limit'] ) &&$_GET['limit'] ) {
$args['posts_per_page'] =$_GET['limit'];
}

if( isset( $_GET['offset'] ) &&$_GET['offset'] ) {
$args['offset'] =$_GET['offset'];
}

$products = new WP_Query($args );


Can somebody help me what to do as i am not a programmer…please.
All the best
Borut

0
2 months 2022-12-20T09:13:35-05:00 0 Answers 0 views 0