Home Forums Backend Issues (wp-admin) Action/Filter to Prevent Field Rendering


Action/Filter to Prevent Field Rendering

  • Is there an action or filter that can be used to prevent a field from rendering on the edit page? I have a theme where an administrator can add the code for the a twitter widget to a field in an options page. Then my hope is that I can set up a field so that if that twitter code exists, a checkbox shows up on when editing the homepage, but if it doesn’t exist, no checkbox will show up.

    I’ve tried return false from the acf/render_field filter, but that doesn’t work. I’m pretty sure I could use the acf/load_field filter, but that’s a bit more dangerous since that’s called in a number of other places.

  • Hi @the-jake-group,

    The acf/render_field filter is used to render the field’s input and thus would not be applicable in this scenario.

    You can use the available conditionals to set the visibility of the fields, this would be after you have successfully registered your twitter widget to appear on the dropdown.

    The acf/load_field would also be an effective option if you set it up correct. I am willing to help in the implementation.

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

The topic ‘Action/Filter to Prevent Field Rendering’ is closed to new replies.