Brain-WP/Cortex

get_post() does not work

Closed this issue · 0 comments

I set this route:

$routes->addRoute(new QueryRoute(
    "/corsi/{slug:[a-z0-9\-]+}",
    function (array $matches) {
        return [
            'post_type' => 'product',
            'name'      => $matches['slug'],
        ];
    }
));

But if I call get_post() inside template, I get false, instead of the WP_Post object.

I believe the problem is due to WordPress 6.0