I created a custom field inside of a custom Gutenberg block (using ACF). It is a Post Object field that accepts multiple post IDs. When inside that post, I can pull the data just fine and everything is working– I can loop through the IDs and output the correct information.
Now, from other posts I want to use WP_Query
to find posts that are using that custom block and custom field and are related to the current post, but I can’t figure it out. If it were a typical custom field, I’d simply use a meta_key
. But this seems more complex because the data is somewhere inside the post_content
not the meta
where standard custom fields live.
I know my example uses ACF, but I would have this same question whether I created the custom block and field manually or using ACF.
Basically I want to edit a Case Study post and correlate it to different industries (which are other posts). Then, on those individual industry pages I want to query and cross-link related Case Studies.
Can someone point me in the right direction?