Home Forums Backend Issues (wp-admin) How to prevent ACF from displaying


How to prevent ACF from displaying

  • Hello,
    using ACF Pro, I have a set of ACF fields that are attached to my “ad” custom post type. As expected, they do appear when editing or creating such a CPT.

    I’d like to have a function to make them NOT appear on post-new.php?post_type=ad when user doesn’t have at least a published “site” custom post type.

    (that’s because I don’t want my user to be able to draft and submit an “ad” if he didn’t get its “site” approved first)

    I already have the “check if user has at least a published “site” CPT” part, but I can’t figure out how to prevent / remove the fields from my edit.php page.

    I tried removing the metabox, but it doesn’t seem to work (or I don’t get the ID right ?)

    Is there an action / filter I should use ? I didn’t find anything about that.
    I could remove the fields with jQuery, but then it would be easy for a trespasser to disable javascript and go forward, which I want to prevent.

    Any idea ?


  • Hi @baptistelegrand,

    Thanks for the post.

    In regards to this use case, I believe the best approach would be to create some custom location rules and assign these to the field group.

    You will then be able to control the appearance of the field depending on the logic behind the rule.

    Here is a starter guide on how to set this up:

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

You must be logged in to reply to this topic.