Support » Developing with WordPress » update_user_meta() usage is highly discouraged

  • Resolved siddhartha


    update_user_meta() usage is highly discouraged, check VIP documentation on Working with wp_users

    i got this error in theme sniffer plugin how i can resolve

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    Well, you could update the usermeta table directly by using $wpdb object methods like $wpdb->update(). Then you are not using update_user_meta(). I’m not sure you are gaining anything though, it sort of amounts to the same thing. The only other alternative is don’t use user meta at all for storing user data. Except that’s what the table is there for.

    I don’t understand why it’s discouraged. It’s not that simple. Used appropriately, there’s nothing wrong with the function. Like most things, it can be misused to the detriment of performance. What does the VIP documentation on Working with wp_users have to say on the subject?




    The message comes from the WordPress Coding Standards. They link to this page:, which doesn’t appear to exist anymore.

    Searching for “Working with wp_users” on Google returns this URL:, but it appears to be private.

    Searching the coding standards repo turns up this issue which proposed flagging the use of user meta for this reason:

    This table is huge on and queries on it can easily cause performance issues. This includes doing any JOIN or meta operations against this set of tables.

    For storing user additional user metadata, you should look at User Attributes.

    Further searching revealed the responsible code was in the WordPress/Sniffs/VIP/RestrictedFunctionsSniff.php file.

    Note that the original proposal mentions, and that the file responsible for the message is in the VIP folder. This means that the issue is specific to the VIP coding standards, and is for reasons that are specific to that service.

    Are you developing for VIP? If you are you should be able to access the link above for the documentation on what you’re supposed to do. If you’re not then you shouldn’t be sniffing your theme with the WordPress-VIP coding standards.

    • This reply was modified 6 months, 3 weeks ago by  Jacob Peattie.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘update_user_meta() usage is highly discouraged’ is closed to new replies.