Why does have_posts() return false when in the wordpress admin, but not on the frontend?

To get your posts to display in the Gutenberg editor, you’ll likely need to create a separate query specifically for your custom block. This is because Gutenberg doesn’t use the main query in the same way the front end does.

Something like this:

$args = array(
    'post_type' => 'your_custom_post_type', // Replace with your custom post type
    'posts_per_page' => 10, // Adjust as needed
);

$block_query = new WP_Query($args);

if ($block_query->have_posts()) {
    while ($block_query->have_posts()) {
        $block_query->the_post();
        // Your code to display each post goes here
    }
    wp_reset_postdata();
} else {
    echo '<p>No posts found.</p>';
}

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino