Home Forums ACF PRO Comment field backend only


Comment field backend only

  • I’m adding a field to toggle whether a comment is sticky or not, so I can bring to the top on the frontend an important comment, via ticking an option on the comment in wp-admin.

    When I set the ‘Show this field group if’ to Comment = All it shows on the backend as well as the frontend. I’m generating the comment form using comment_form( $args )

    How can I get this field to be backend only?

  • Add a prepare field filter and return false if it is not the admin

    add_filter('acf/prepare_field/name=YOUR_FIELD_NAME", 'admin_only_field');
    admin_only_field($field) {
      if (!is_admin()) {
        return false;
      return $field;
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.