WordPress Query inconsistency -


i having challenges wp_query: when echo title of cpt in first section: posts shown required posts_per_page. when try loop query , make options in select tag, ten titles. causing limit? how can fix it? thanks

<?php     $safaris_args = array(       'post_type'         => 'safaris',       'posts_per_page'    => -1     );     $safaris_query = new wp_query( $safaris_args );     if( $safaris_query->have_posts() ):         while( $safaris_query->have_posts() ): $safaris_query->the_post();         echo '<p>' . get_the_title() . '</p>';     endwhile;     endif;     ?> ------------------------------------------------------------------------   <select id="safari" class="form-control" id="safari" aria-required="true" aria-invalid="false">     <?php       $safaris_args = array(         'post_type'         => 'safaris',         'posts_per_page'    => -1       );       $safaris_query = new wp_query( $safaris_args );       if( $safaris_query->have_posts() ):           while( $safaris_query->have_posts() ): $safaris_query->the_post(); ?>              <option value="<?php the_title(); ?>" id="<?php the_id(); ?>"><?php the_title(); ?></option>       <?php           endwhile;       endif;     ?>   </select> 

image showing issue


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -