Skip to content

Instantly share code, notes, and snippets.

@ControlledChaos
Last active February 28, 2018 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ControlledChaos/7eea26988f221b0d9ecdb510fde66d86 to your computer and use it in GitHub Desktop.
Save ControlledChaos/7eea26988f221b0d9ecdb510fde66d86 to your computer and use it in GitHub Desktop.
Resets the metabox layout on post edit screens. Comes in handy when Advanced Custom Fields position, such as "high, after title", is being ignored.

Reset Metabox Layout

WordPress Snippet

<?php
function ccd_reset_metabox_layout(){
delete_user_meta( wp_get_current_user()->ID, 'meta-box-order_post' );
delete_user_meta( wp_get_current_user()->ID, 'meta-box-order_page' );
delete_user_meta( wp_get_current_user()->ID, 'meta-box-order_custom_post_type' );
}
add_action( 'admin_init', 'ccd_reset_metabox_layout' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment