Quick q: is it not possible to select a parent post from a child post if the parent post is not yet published (e.g., is in Draft status)? This is what I am experiencing just now.
We wish to display relational content on a parent post including child post fields; and we don't want to publish the parent post until these relationships have been declared. But since we cannot select the appropriate child post(s) from the parent post, and since we apparently cannot select a *draft* parent post from its child(ren), we cannot find a way around this issue.
Many thanks for your assistance.
Regards,
Jim P.
No, this is not possible with Toolset by design.
Only Published Posts can be chosen, as this is the only status where the Post is available in all instances.
What I can provide is a Filter for usage in CRED Child Forms what will return any Post Status:
add_filter('cred_get_potential_parents_post_status', '_pr_belongs_post_status');
function _pr_belongs_post_status($statuses)
{
return 'any';
}
For the WP Backend you should be able to use:
add_filter( 'wpcf_pr_belongs_post_status', 'my_wpcf_pr_belongs_post_status' );
function my_wpcf_pr_belongs_post_status($statuses)
{
$statuses[] = 'draft';
return $statuses;
}
This is Custom code and subject to eventual changes in the API.
Please let me know if you have further questions regarding the issue mentioned in this Thread
and let me know if the above solution works for you, I look forward to your reply!
Thank you for your patience.
Beda, many thanks as usual for your excellent help. I will attempt a workaround via a many-to-many relation (which I probably need for these two CPTs anyway), which should in theory allow me to make the connection btw them from either direction.
Regards,
Jim P.