Leave a Reply

1 comment

  1. Try following code it will work with if statement as well.

    define( 'MY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    
    function catch_plugin_template( $template ) {
    
        if( is_page_template('page_template.php') ){
    
            $template = MY_PLUGIN_PATH . '/page_template.php';
    
        } 
    
        return $template;   
    } 
    add_filter('template_include', 'catch_plugin_template');