Skip Navigation

[Closed] Post Relationship Parent Only in Drop Down

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 9 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#237587

I've created a hierarchical post type called "Groups" that obviously will have parent and children pages. "Groups" has a post relationship with another post type "People". When I go to create a new People post is there a way to only show the parent items from my "Groups" post type in the drop down?

#237625

Hi brianG-4,

It is not possible within current version of Types, and I put it into our to-do list as a feature request. our developers will take care of it.

#237705

Thanks! Typically, what's the time-frame for new features to get added? Are we talking weeks? months?

#237973

Sorry, I am not sure when will it be applied into Types plugin, if you need, there is a workarround:
1) modify the Types plugin file \wp-content\plugins\wp-types\embedded\includes\post-relationship.php, line 290
From:

        'suppress_filters' => 0,

To:

        'suppress_filters' => 0,
		'post_parent' => apply_filters( 'wpcf_pr_belongs_post_parent', null,  $type, $post),

2) add codes in your theme/functions.php:

add_filter( 'wpcf_pr_belongs_post_parent', 'parent_items_func', 10, 3 );
function parent_items_func($post_parent, $post_type, $post){
	if(is_admin() && $post_type == 'groups' && get_post_type($post->ID)=='people'){
		$post_parent = 0;
	}
	return $post_parent;
}

Please replace "groups" with the slug of post type "Groups", and replace "people" with the slug of post type "People"

The topic ‘[Closed] Post Relationship Parent Only in Drop Down’ is closed to new replies.