Skip to content

Instantly share code, notes, and snippets.

@nathanieltubb
Last active July 13, 2018 21:57
Show Gist options
  • Save nathanieltubb/906547ad001054de40eb1ec2c5d92367 to your computer and use it in GitHub Desktop.
Save nathanieltubb/906547ad001054de40eb1ec2c5d92367 to your computer and use it in GitHub Desktop.
WordPress Database Reset All Users' Metabox Locations
-- Reset all users' metabox placement. This is useful when changing location of existing ACF field groups.
-- Run these separately, and replace the table prefix and meta_keys with your own.
-- Search for current metabox values:
SELECT *
FROM wp_usermeta
WHERE meta_key
LIKE 'meta%'
-- Look for the meta-box-order_[post_type_slug] and metaboxhidden_[post_type_slug] keys.
-- Run the reset on the necessary rows based on the post type you are targeting.
UPDATE wp_usermeta
SET meta_value='a:0:{}'
WHERE meta_key IN ('meta-box-order_[post_type_slug]','metaboxhidden_[post_type_slug]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment