Custom post type only store 10 post only
-
i create a custom post type with ACF fields for my slider but everytime i query my custom post type it only shows 10 post even though i have more (like 14 post) and if i add more it just replace the other.
Here’s my code :
function custom_slider_post_type(){ $args = array( 'public' => true, 'supports' => array('title', 'thumbnail'), 'labels' => array( 'name' => 'Store Images', ), ); register_post_type('slider_image', $args); } add_action('init', 'custom_slider_post_type');
and this is my query:
$slider_images = new WP_Query(array( 'post_type' => 'slider_image', 'post_per_page' => -1, )); if($slider_images->have_posts()){ $images = array(); $checkAll = array(); while($slider_images->have_posts()){ $slider_images->the_post(); $parent_sections = get_field('parent_section_field'); $image = get_field('homepage_banner'); $product_link = get_field('products_link'); $checkAll[] = array( 'image' => $image, ); $show_in_beauty = false; if($parent_sections){ foreach($parent_sections as $parent_sections){ if($parent_sections->post_name === 'beauty-products'){ $show_in_beauty = true; break; } } } if($show_in_beauty){ $images[] = array( 'image' => $image, 'link' => $product_link, ); } } var_dump($checkAll); print_r(count($checkAll));
Solved: i forgot to add s in
'post_per_page' => -1,
- The topic ‘Custom post type only store 10 post only’ is closed to new replies.