Add Page Template from Plugin

add_filter( 'theme_page_templates', 'pt_add_page_template_to_dropdown' );

function sf_add_page_template_to_dropdown( $templates )
{
   $templates[plugin_dir_path( __FILE__ ) . 'templates/page-template.php'] = __( 'Page Template From Plugin', 'text-domain' );
 
   return $templates;
}

snippet from https://www.pradipdebnath.com/2019/08/17/how-to-add-page-template-from-plugin-in-wordpress/
Comments