Remove Inpost Layout Options

<?php
/**
* Remove Inpost Layout Options
*
* Use if you have hardcoded the layout on certain template pages
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/remove-inpost-layout-options
*/
function be_remove_inpost_layout_options() {
// Get the Post ID
if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
if( !isset( $post_id ) ) return;
// Get the Page Template
$template_file = get_post_meta( $post_id, '_wp_page_template', true );
$exclude_layout = array( 'template-products.php' );
if ( in_array( $template_file, $exclude_layout ) )
remove_meta_box( 'genesis_inpost_layout_box', 'page', 'normal' );
}
add_action( 'admin_enqueue_scripts', 'be_remove_inpost_layout_options' );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk