Forum Replies Created
-
AuthorPosts
-
wpmusketeerMemberAlthough it still only works with ‘belongs_to’ not ‘post_belongs’…
wpmusketeerMemberOK. Sorted it.
On the Contact edit page I had to supply
'post_status' => 'any'. I assumed not supplying a ‘post_status’ parameter would be the same thing. And indeed, on the Job edit page it seems to work fine (my Job CPT has custom statuses, perhaps that’s why). But on the Contact CPT it doesn’t work without ‘post_status’ supplied.
wpmusketeerMemberHmm… I’ve done some more testing.
I’ve added the following on the edit page of a Job this time:
$related = get_posts( array( 'post_type' => 'contact', 'posts_per_page' => -1, 'post_belongs' => $post->ID, 'suppress_filters' => false, ) ); echo var_dump( $related );This still doesn’t work, but when I change ‘post_belongs’ to ‘belongs_to’ (which I did accidentally because I have Rails syntax ingrained in my brain) it worked! I haven’t seen this documented anywhere so I’m pretty perplexed.
However, even ‘belongs_to’ doesn’t work on the Contact edit page. The above is redundant on the Job edit page because I’m already able to see the attached Contact in its relevant metabox. I really need to see the list of jobs attached to a Contact when on the Contact edit page.
-
AuthorPosts