Support

Account

Home Forums Add-ons Flexible Content Field Disable add/delete/move Flexible Content for non-admins Reply To: Disable add/delete/move Flexible Content for non-admins

  • There are 2 ways you can do this.

    1) Add an ‘admin_head’, action that outputs CSS to hide controls if the user is not an admin.

    2) The second way is with JavaScript, you can remove the controls completely something like this is a basic example, I’m sure I’m missing something but it might get you started

    
    (function($){
      if (typof acf === 'undefined') {
        return;
      }
      acf.add_action('ready append') {
        // target all flex fields
        // you can adjust this selector to target specific flex fields
        // but adding [data-key="field_XXXXX"] before the selector
        $('.acf-flexible-content a').each(function(index, element) {
          $(element).remove();
        });
      }
    }(jQuery);