Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Update page template and remove page editor in wordpress

function md_update_page_template() {
  global $post;

  if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID && '' == $post->page_template )  {
    remove_post_type_support( 'page', 'editor' );
    $post->page_template = "templates/template-page-v1.php";
  }
}
add_action('add_meta_boxes', 'md_update_page_template', 1);
 
PREVIOUS NEXT
Tagged: #Update #page #template #remove #page #editor #wordpress
ADD COMMENT
Topic
Name
9+4 =