Home Forums ACF PRO what is the best solution for relating fields within 2 post types


what is the best solution for relating fields within 2 post types

  • I am trying to do the following:
    I have a post type article with a number of fields. Two of which are: a reference-name field and another field is a reference content field.

    I have a second post type called references. In references I have a reference name field and an references-detail field.

    Now what I would like to do is that each time a reference name is mentioned in an article (to start with in the article reference name field) I would like to set up a hover or hyperlink to show the reference detail.

    So for example if
    I have a reference name: george washington
    I have a reference-detail: first president of the USA
    and I have reference content: “Of all the dispositions and habits which lead to political prosperity, religion and morality are indispensable supports.”

    On my article page I would like to write George Washington and I would like it to be connected to the reference detail “first president of the USA” each time George is mentioned in articles on the site.

    How can I set this up?
    What fields do i need to use to set that up and is their a tutorial that could walk me through the steps.

    Ideally – I would also be able to search my site for all mentions of george washington and see what he said.

  • Unless I’m misunderstanding what it is you want to do, this isn’t something that can be done with ACF. It could be done, but you’re talking about linking content entered into a content editor and automatically linking that content to another post. What you need here is to add a filter on “the_content” ( that searches the content, finds the reverences and then adds the links, all of which would undoubtedly slow down your site as you get all the links and then search for each of the things you want to link.

  • thanks John. I will look into this.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.