WordPress The Loop (main WordPress loop) Alternative loop syntax


Example

You can also use loop with curly brackets like this:

if ( have_posts() ) {
    while ( have_posts() ) {

        the_post(); 
        var_dump( $post );
    
    }
}