Support

Account

Home Forums General Issues Relationship field : results only by tags, not content.

Helping

Relationship field : results only by tags, not content.

  • Hi,

    How could i force the relationship field to display results only by tags ?
    If i have a “car” tag for 1 post, i just want to see other posts list with “car” tag too, excluding posts containing “car” in their content, if they have not the correct tag attached.

    Thanks !

    PS : i assume that i have to add PHP query code somewhere. In this case, please tell me in which file i have to modify.

  • It’s a bit more complex than that. You would need to hook up the a filter that will allow you modify the values that the relationship field has:

    https://www.advancedcustomfields.com/resources/acf-prepare_field/

    Once you are in there, you create a query that will load only those posts that have the car tag and then return the value. When the post loads, it will only display those posts.

    It depends on how your code is setup and names of variables, so it’s going to be a simple copy/paste.

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

The topic ‘Relationship field : results only by tags, not content.’ is closed to new replies.