Good day!

Tell me, can someone make a plugin as a module to the site? Ie, I want, for example, when opening mysite.com/myplugin/, any internal page of the plugin is displayed in public access. Can anyone have examples of how to do this?

Thank you

    2 answers 2

    Create a page myplugin.php , put it, for example, in the root of the folder with the plugin. The following code snippet allows you to check if a page with that name is accessed, and if so, apply the desired template.

     add_filter( 'template_include', 'template_include_function', 1 ); function template_include_function( $template_path ) { if(is_page('myplugin')){ $template_path = plugin_dir_path( __FILE__ ) . '/myplugin.php'; } return $template_path; } 
    • It seems that this is what I need! - RSalnikov

    .htaccess redirect rule, at least to the space even on the plug-in file

    • Okay, what's the point then from the plug-in, if a person needs to manually add a huge number of lines with revriths to the Wordpress root in .htaccess? - RSalnikov
    • What prevents to make a general rule for a particular folder? - Gam-Studio