I have an external script that does some DB maintenance through WP_Query and similar functions. It used to work great, but now after a PHP version update (from 7 to 8) it stopped working.
The necessary WP header files are included, but the script crashes at first WP function call without an error message. I tried to call various WP functions. What can be the problem?
Here is the script:
<?php
define( 'WP_USE_THEMES', false );
require __DIR__ . '/wp-blog-header.php';
// The Query
$args = array(
'post_type' => 'post',
"posts_per_page" => "1",
'order' => 'DESC',
'orderby' => 'ID'
);
$the_query = new WP_Query( $args );
?>
UPDATE: I succeeded to get the error message finally:
Fatal error: Uncaught Error: Class "WP_Query" not found in /home/zrksvcvh/public_html/videos_update.php:46 Stack trace: #0 {main} thrown in /home/[...]/public_html/videos_update.php on line 46
/videos_update.php
and bring your server down