0

I have a custom post type with 9 custom pages on WP 4.5.

When I got to Settings -> Reading -> A static page -> front page dropdown,

I see a list of all the standard wp pages plus at most 5 of my custom pages (the most recent 5 of them).

I have no clue on why just 5 and I need to show all of them.

I'm using this code to load them on the dropdown:

function my_custom_add_to_dropdown( $pages, $r ){
if('page_on_front' == $r['name']){
    $args = array(
        'post_type' => 'mytype'
    );
    $stacks = get_posts($args);
    $pages = array_merge($pages, $stacks);
}
return $pages;
}
add_filter( 'get_pages', 'my_custom_add_to_dropdown', 10, 2 );

I have checked with print_r($stack) and the output is of the most recent 5 custom post pages. I need all 9 of them there. (I always want all of them there)

Anyone can help me? What I must change to unlock all the custom post pages to show up?

1 Answer 1

1

If you want to show all custom post pages then you need to add:

$args = array(
    'post_type' => 'mytype',
    'showposts' => '-1',
);

Hope above code is help

1
  • there should be numberposts instead of showposts
    – T.Todua
    Commented Jan 25, 2017 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.