I am unable to have an ACF Block with a Taxonomy field, save a Taxonomy Term to the Term Relationships table for the CPT the ACF Block is saved to. The idea is to later query the CPT to return all the ACF Blocks with the Taxonomy Term. Details below:
I have a a CPT called Testimonials – it is using an ACF Block called Testimonial and a custom Taxonomy called Member Type. The Testimonial Block is using an ACF Taxonomy field (with “Save Terms” set to “yes”); the idea is to have the user select the Taxonomy Term from here (and not from the Document tab taxonomy metabox). I then have an ACF Block called Testimonial Picker, to be used on a Page, who’s job is to select Testimonial blocks randomly from by having a user select the Member Type term they want to use.
The Testimonial Picker is using a WP_Query to pull all Testimonials (CPT) with the Taxonomy (Member Type).
Validating the Issue
I was having trouble with the query to pull all Testimonial post types by the Taxonomy Term. I took a peak inside the term_relationship table and observed no values were being inserted in there from the Testimonial Block (using the ACF Taxonomy field).
I managed to validate my query was functioning as desired:
If I select the Taxonomy Term from the Gutenberg document tab, in the Taxonomy metabox, then the relationship is made and I am able to query and return the proper Testimonial Block.
It seems the connection between the ACF Block and the CPT is not being made in order to get the Taxonomy Term to associate with the CPT.
I’m not sure if I’m missing something. The hope is to have the user use the Taxonomy field in the Block (vs in the Document tab of the CPT).