Skip Navigation

[Resolved] CRED form does not show all parent post options

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a CRED form on my site that has been in use for a while. After a recent update, a parent post select field does not include all options that were previously shown. I have the filter cred_get_potential_parents_post_status in place in my theme.

Solution: Return an empty string in this filter if you wish to show parent posts of all statuses.

add_filter('cred_get_potential_parents_post_status', '_pr_belongs_post_status');
function _pr_belongs_post_status($statuses)
{
    return '';
}
This support ticket is created 6 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#614991

I have a CRED form that is used to create a child post of two parents, When creating the post the there are fields to select the parent posts.

However the parent post select is no longer being populated and I am getting the message "No results found". It was working but has stopped working with more recent CRED/TYPES updates (unsure which).

The cred field shortcode that is no longer working is [cred_field field="_wpcf_belongs_doula-profile_id" value=""]

#615002

Hi, I'll be glad to take a look. Please try the following troubleshooting steps first:
- Temporarily activate a default theme like Twenty Seventeen and deactivate all plugins except Types, Views and CRED. If you need to activate a plugin like Maintenance Mode during testing, that's fine.
- Test the CRED form again
- If the parent post titles are appearing as expected, reactivate your theme and other plugins one by one until the conflict is revealed.
- If the parent post titles are still not appearing as expected after deactivating plugins, please open the browser console and load the CRED form in your browser again. Try the parent field and watch for any JavaScript errors that appear in the console. Copy those into your next reply for me to review.

Please let me know what you find and we can go from there.

#615025

Hi,

I think I have pinned this down to a filter in my child theme's functions.php file:

 add_filter('cred_get_potential_parents_post_status', '_pr_belongs_post_status');
function _pr_belongs_post_status($statuses)
{
    return 'any';
}

When I remove this filter the form works.
It was working previously with this code included.
Thanks
Chris

#615028

It would seem if I replace the

return 'any';

with

return 'pending';

OR with

return 'publish';

It works. But I ideally need it to work with any status.

Thanks

#615042

Okay thanks for the additional information. Since this filter is undocumented, I am unsure about how it is supposed to work. Let me reach out to my 2nd tier support team for some additional information, and I will update you as soon as I have more details.

#615285

Okay I have been unable to reproduce this issue locally, so my 2nd tier support team has asked for a clone of your site so we can do some additional investigation. Please provide login credentials in the private reply fields here if that's okay with you, and I will install the Duplicator plugin to create that site clone.

#616176

I updated the theme's functions.php file to return an empty string in the callback function:

add_filter('cred_get_potential_parents_post_status', '_pr_belongs_post_status');
function _pr_belongs_post_status($statuses)
{
    return '';
}

I'm able to find Clare Sc... (a pending profile) now in the profile parent select field. Can you confirm?

#616199

That's great - it seems to have done the trick - many thanks!