Hi there,
Is there any way to disable the add/delete/move options for non-admins? I’d like my clients to simply edit the content, but no more than that.
I think I could remove some of the features with CSS, but if there is a more natural approach i’d like that instead.
I use Advanced Custom Fields: Extended as well if that makes a difference.
Best,
Dave
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);