WordPress移除某些页面模板

WordPress移除某些页面模板

/**
 * Remove Page Templates from the Parent Theme so they are no longer an option in the Child Theme
 * This solution works for WP 3.9 and up
 * 
 * @source: http://wordpress.stackexchange.com/a/138555/2015
 */
add_filter( 'theme_page_templates', 'so_remove_page_template' );
function so_remove_page_template( $pages_templates ) {
    unset( $pages_templates['onecolumn-page.php'] );
    // change this for the name of the template you want to remove 
    return $pages_templates;
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据