• Hello,
    I put this simple code in a snippet.
    I get an error that blocks the whole site. I can’t log in to the dashboard.
    I need to log into the database and disable the database snippet.
    Where is it wrong?
    =================
    $args = array(
    ‘post_type’ => ‘post’,
    );
    $the_query = new WP_Query( $args );

    // The Loop
    if ( $the_query->have_posts() ) {
    echo ‘

      ‘;
      while ( $the_query->have_posts() ) {
      $the_query->the_post();
      echo ‘

    • ‘ . get_the_title() . ‘
    • ‘;
      }
      echo ‘

    ‘;
    } else {
    echo ‘<h1>no posts found</h1>’;
    }
    /* Restore original Post Data */
    wp_reset_postdata();

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Unfortunately, the code you posted is a little malformed. Can you re-post, making sure to put the code in backticks (`)?

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal error WP_Query’ is closed to new replies.