WordPress: Post Query

Beiträge in WordPress anzeigen… die wahrscheinlich beste Variante!

$posts = get_posts([
    'post_type' => 'post',
    'post_status' => 'publish',
    'orderby' => 'date',
    'order' => 'DESC',
    'posts_per_page' => -1,
    'cat' => 1,
]);

foreach ($posts as $post) {
    setup_postdata($post);
    
    the_title();
    the_content('', false);
}

wp_reset_postdata();