Support » Plugin: ACF-VC Integrator » hide draft / unpublished posts from query

  • Resolved wasifh


    I am looking for a solution to hide draft / private posts from displaying under current research studies on the link provided. Is there a way to exclude draft and private posts from a query for relationship fields.

    Preference would be not to touch the plugin’s code because it’ll be overridden if I update it later on. Can i add a function in my own code (e.g., in my functions.php) to achieve the same result?

    • This topic was modified 1 year, 2 months ago by wasifh.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frederik Rosendahl-Kaa


    Hi @wasifh,

    This should be possible using the built-in filter hooks in the plugin.

    I have done an example function that only shows the posts that have been published using this filter hook function acfvc_relationship.

    All you have to do is insert it into function.php in the theme / child theme folder and make sure the relationship field is set to return format Post Object.
    If it is not set to return format Post Object then code must be changed so that it can use return format Post ID.

    Best regards
    Frederik Rosendahl-Kaa

    Awesome, thank you so much for your help. Adding the code in fuction.php did the trick

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hide draft / unpublished posts from query’ is closed to new replies.