Home Forums Backend Issues (wp-admin) How to lock/disable user meta information once filled and submitted


How to lock/disable user meta information once filled and submitted

  • Much like the username is locked down and cannot be changed once it has been registered, I would like to lock down additional fields I have created with Advanced Custom Fields like the person’s cellphone number which is vital for us to have because it is linked to a security gate entrance and should not be changed

    What I need to be able to have happen is that once someone completes a field and submits their new information, that field needs to be locked down when the page reloads and only an administrator can change it.

    I know this can be done with javascript but I want to be sure that someone who knows how to use the Developer Toolbar is not able to change the field attribute and submit or delete content. Or if someone just happens to have JS switched off, they would be able to change this.

    Is there a WordPress hook that exists to do something like this please?

    Many thanks

  • Hi @sixfootjames


    ACF does have a filter called ‘acf/update_value’ which you could hook into.
    This filter also sends through the $field array which it is saving to, so you can look at the $field[‘key’] as a way to run code specific to your desired field.

    Basically, you could load the previous value, and if a value was found, don’t allow the new ‘different’ value to be saved by updating $value to the old value.

    Does that make sense?

    You will find docs on the filter over on the docs page.

    Then you can use JS to add a simple disabled attribute to in the input for the client’s visual


  • Thanks Elliot.

    Second time I run into a scenario where I need this so I will look into it now šŸ˜‰


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

The topic ‘How to lock/disable user meta information once filled and submitted’ is closed to new replies.