$label); return array_merge( $templates , $blank_page_template); } ); add_filter( 'theme_post_templates', function ( array $templates ) use ($file,$label) { $blank_page_template = array($file => $label); return array_merge( $templates , $blank_page_template); } ); } } if ( ! function_exists( 'blank_page_template_load_template_to_front_end' ) ) { function blank_page_template_load_template_to_front_end($file,$plugin_name) { add_filter( 'template_include', function ( $template ) use ($file,$plugin_name) { if ( is_singular() ) { $post_template = get_post_meta( get_the_ID(), '_wp_page_template', true ); if($post_template) return (strpos($post_template, $plugin_name) !== false) ? wp_normalize_path($file) : get_page_template(); } return $template; } ); } } add_action( 'plugins_loaded', 'blank_page_template_bootstrap' );