Skip Navigation

[Closed] Custom List Pulling from CPT only shows 12 items

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 3 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#1950411

Tell us what you are trying to do?

I have some code (below) that pulls items from a custom post type into a field in the back end of the website. This only seems to be showing 12 items, and none of the recent posts.

// List Projects in Investment Field:Linked Projects
add_filter( 'wpt_field_options', 'populate_select', 10, 3);
function populate_select( $options, $title, $type ){
switch( $title ){
case 'Linked Development Project':
$options = array();
$args = array(
'post_type' => 'project',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$posts_array = get_posts( $args );
foreach ($posts_array as $post) {
$options[] = array(
'#value' => $post->post_name,
'#title' => $post->post_title,
);
}

break;
}
array_unshift($options,"");
return $options;
}

Kindest regards,

Pete

#1951079

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean that with your select field "Linked Development Project" you only see 12 options with your select dropdown but there are more posts so the dropdown should display more options?

If above is correct - can you please share problem URL where you added the "Linked Development Project" dropdown as well as the related code and send me admin access details so I can review whats going wrong there.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

The topic ‘[Closed] Custom List Pulling from CPT only shows 12 items’ is closed to new replies.