Last active
September 30, 2018 16:56
-
-
Save nickcernis/88727dc111e94657c283 to your computer and use it in GitHub Desktop.
Remove Genesis custom layout metabox on pages with a set template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I had to change the priority to 0 to get this to work.