Brain-WP / Cortex

Routing system for WordPress
MIT License
348 stars 20 forks source link

get_post() does not work #35

Closed metaline closed 2 years ago

metaline commented 2 years ago

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