Home > Blockchain >  WP_Query prints out invisible elements on some browsers
WP_Query prints out invisible elements on some browsers

Time:08-08

Got a problem where on some browsers (Chrome in this case) my printed out content is invisible. The content can however be seen in the DOM. Entering Incognito mode solves this. I'm also sure this isn't a css problem. Var Dumping the post also shows every thing correctly it's just that some containers are completely invisible. I assume this is a cache issue but I don't have any cache plugins or anything set up right now.

Cutdown version of actual code:

<?php
 $args = array(
     'post_type' => 'ad',
     'posts_per_page' => -1
 );


 $query = new WP_Query($args);
 ?>

<?php if ($query->have_posts()) : ?>
    <div>

        <?php while ($query->have_posts()): $query->the_post(); ?>

             <!-- if I were to create a new container on this row it would show up -->
             <div >
                  <!-- This container however is invisible -->
                  <?php the_title();?>
                  <?php the_content();?>
             </div>

        <?php endwhile; wp_reset_postdata();?>

    </div>
<?php endif;?>

CodePudding user response:

Do you have an ad blocker installed in your browser maybe? This behavior can be caused by them

  • Related