Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Last active September 30, 2018 16:56
Show Gist options
  • Save nickcernis/88727dc111e94657c283 to your computer and use it in GitHub Desktop.
Save nickcernis/88727dc111e94657c283 to your computer and use it in GitHub Desktop.
Remove Genesis custom layout metabox on pages with a set template
<?php
/* Remove Genesis post layouts metabox if template matches 'custom-layout.php'*/
add_action( 'admin_menu', 'custom_remove_custom_layouts' );
function custom_remove_custom_layouts() {
$template_file = get_post_meta( $_GET['post'], '_wp_page_template', true );
if ( $template_file == 'custom-layout.php' ) {
remove_action( 'admin_menu', 'genesis_add_inpost_layout_box' );
}
}
@carasmo
Copy link

carasmo commented Sep 30, 2018

Thanks! I had to change the priority to 0 to get this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment