All,
We have used the post object field to basically allow users to link 2 different pages.
Now we just need to find the pages that have a certain post object id (so meta_query searching by post object) – Is that not possible? Unfortunately we have hundreds of pages that have already been set using the post object (changing the field id or relationship would be hours of work).
I’ve tried this but it’s not working:
$args = array(
'post_type' => 'bsk_documentation',
'posts_per_page' => 1,
'meta_query' => array(
array(
'key' => 'product_sales_page',
'value' => '"' . $product_page_id . '"',
'compare' => 'LIKE'
)
)
);
$the_query = new WP_Query($args);
if($the_query->have_posts() ):
while( $the_query->have_posts() ) : $the_query->the_post();
#show post info
endwhile;
endif;
I’ve also tried get_posts() with no luck.
Thank you guys for any help,
T
Guys,
I’m slow – It looks like Elliot solved it on this thread – But the problem was someone else’s answer was highlighted with code (and I mistakenly thought theirs was the solution when it’s not). Elliot’s response here (which is the solution and easiest possible thing to do) –
From this page – https://support.advancedcustomfields.com/forums/topic/meta-query-for-post-object/
Your meta key will need to be the name of the field, and your meta value will need to be the $post_id
Hope this helps others in the future,
T