add_filter( 
	'page_template', 
	function( $page_template ){
		if ( get_page_template_slug() == 'custom-template.php' ) {
			$page_template = __DIR__.'/custom-template.php';
		}
		return $page_template;
	}
);
add_filter(
	'theme_page_templates', function( $posts_templates ) {
		$posts_templates = array_merge( 
			$posts_templates, 
			array(
				'custom-template.php' => '模板名称',
			)
		);
		return $posts_templates;
	}
);