plugin url wordpress code example
Example: wordpress plugin public page
public function mypage_rewrite_ext() {
global $wp_rewrite;
$plugin_url = plugins_url( 'mypage.php', __FILE__ );
$plugin_url = substr( $plugin_url, strlen( home_url() ) + 1 );
// The pattern is prefixed with '^'
// The substitution is prefixed with the "home root", at least a '/'
// This is equivalent to appending it to `non_wp_rules`
$wp_rewrite->add_external_rule( 'mypage$', $plugin_url );
}