Skip Navigation

[Resolved] Cannot select draft parent post

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

Problem:
How to enable Drafts to appear in the Parent Post Picker of CRED or the WP Backend in Child Post Tables?

Solution:
https://toolset.com/forums/topic/cannot-select-draft-parent-post/#post-371729

This support ticket is created 8 years, 1 month 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by jimP 8 years ago.

Assisted by: Beda.

Author
Posts
#371609

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.

#371729

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.

#371857

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.