Replies: 0
Hi, first of all you carbon fields are very great plugin! Second, I already solved my needs, but I want to keep it as at least a suggestion:
Shouldn’t Association work automatically in both ways?
Post_type_A -> Post_type_B
Post_type_B -> Post_type_A
Usage example:
1) I have post_type: sport-team and matches.
2) Everytime a match happens and I register it, I’m going to associate the 2 sport-team.
3) When I query the fields based on match ID, it works fine: returns array( 0 => 20, 1 => 16 )
4) But when I query by the sport-team ID, carbon_get_post_meta(20, 'crb_association', 'association')
it return nothing.
I could solve using a custom query:
'meta_query' => array(
array(
'key' => '_crb_association',
'compare' => 'LIKE',
'value' => '"post:sportteam:' . $post->ID . '"',
)
)
like you proposed here: https://wordpress.org/support/topic/query-posts-based-on-carbon-fields-value/
But shouldn’t it be a built-in function?
Shouldn’t it be the main purpose of a association field?
I wish I was a better programmer so I could purpose a commit, but I’m not. So I will just register this as a suggestion.
Thank you.