Support » Plugin: ACF Post-2-Post » Support for blocks?

  • With the latest ACf you can create blocks. I created this post-2-post as a block but this doesn’t seem to work. Is there going to be support for blocks?

Viewing 1 replies (of 1 total)
  • Plugin Author John Huebner


    This is not likely to happen, and I will explain why.

    In order to update the reciprocal links in related posts, blocks are stored in the_content. I would need to read the content, find your block, however you set it up, find right information to alter and update the block in the other posts content and then update that content. There isn’t any way I could reliably do this.

    The only way that this plugin will ever work is if the value is stored in the _postmeta table. I am currently interacting directly with the meta using get_post_meta() and update_post_meta(). Event if this could be done using the ACF functions get_field() and update_field() I would need to reliably detect what field needs to be updated on the other side of the relationship. How this works now is that I must get all of the fields that are associated with the post ID on the other end of the relationship and read through them all to find the one that has the same name, if it exists. As far as I know it would be nearly impossible for me to figure out what field on the other end I’d need to update since it would be associated with a block and not a post. You could, after all, insert multiples of these block into a post. In this case, how would I know what to target on the other end or even how/where to update the value.

    Creating a reciprocal relationship field inside a block would likely require custom coding for the specific block/fields in question, that is if it can be done at all.

    However, I’m open to suggestions. If someone can come up with an example of how this can be done in blocks using a single field as in the ACF documentation and this can somehow be adapted for fields with different field keys. I would be willing to give it a shot.

Viewing 1 replies (of 1 total)
  • The topic ‘Support for blocks?’ is closed to new replies.