Home Forums General Issues Link field can’t use readonly


Link field can’t use readonly

  • Link field can’t use readonly. I add a field through this array:
    ‘key’ => ‘field_salesforce_contact_url’,
    ‘label’ => ‘Salesforce Contact URL’,
    ‘name’ => ‘salesforce_contact_url’,
    ‘type’ => ‘link’,
    ‘readonly’ => 1,
    I want user not to edit the link, so I set readonly, but It’s not working, does anyone know where I did it wrong?
    I can also use url field type, but I want that clickable url to direct user to another page, so I want to stick to the link field.

  • You cannot make the field readonly.

    I do not have any examples, there are 2 ways that you can do this.

    The first is to use custom CSS in the admin to hide the edit and delete action button for the field.

    [data-key="YOU FIELD KEY"] .acf-input .link-wrap a {
      display: none;

    The second would be to add custom JavaScript to the admin to remove the action buttons instead of hiding them.

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

You must be logged in to reply to this topic.