RWMB_Core::fix_page_template PHP 메소드

fix_page_template() 공개 메소드

WordPress will prevent post data saving if a page template has been selected that does not exist This is especially a problem when switching to our theme, and old page templates are in the post data Unset the page template if the page does not exist to allow the post to save
부터: 4.3.10
public fix_page_template ( WP_Post $post )
$post WP_Post
    public function fix_page_template(WP_Post $post)
    {
        $template = get_post_meta($post->ID, '_wp_page_template', true);
        $page_templates = wp_get_theme()->get_page_templates();
        // If the template doesn't exists, remove the data to allow WordPress to save
        if (!isset($page_templates[$template])) {
            delete_post_meta($post->ID, '_wp_page_template');
        }
    }