Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

PREVIOUS NEXT
Code Example
Php :: How I can generate the unique transaction ID in laravel 8 
Php :: php remove non printable characters 
Php :: get url parameter laravel 5.2 constructor 
Php :: multiple ternary operator in php 
Php :: remove duplicate characters in a string in php 
Php :: php print string as bytes 
Php :: Drupal 9 entity.repository load entity by UUID 
Php :: php howto ignore file with BOM 
Php :: php extend class 
Php :: remove laravel/octane trminal 
Php :: acf get all choices from select 
Php :: php mysql update all rows in table random values 
Php :: laravel validation if another record is not deleted / not null 
Php :: php pass 2 date value to javascript 
Php :: access model in config laravel 
Php :: php date text in middle 
Php :: add class to row laravel 
Php :: laravel withcount change name 
Php :: phpdoc @var 
Php :: select statement of table in phpmyadmin 
Php :: php inverse / arc cosine 
Php :: Create progress bar with Laravel 
Php :: Laravel unique with Validation rule 
Php :: get HTML select value to PHP 
Php :: htaccess rewrite optional parameters 
Php :: php get api 
Php :: php get error 
Php :: how to deploy php website on server 
Php :: validate number should by 12 digit in php 
Php :: php check string 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =