WordPress.org

Ready to get started?Download WordPress

Forums

Custom Plugin URL (1 post)

  1. brandonbeeks
    Member
    Posted 1 year ago #

    I've read a couple threads on here about creating custom url rewrites for plugins. Most of them look something like this:

    add_action('init', 'my_rewrites');
      function my_rewrites() {   
    
      global $wp_rewrite;
      $new_non_wp_rules = array(
        'mobile-admin/'       => 'wp-content/plugins/mobile-admin/admin.php$1'
      );
      $wp_rewrite->non_wp_rules += $new_non_wp_rules;
      $wp_rewrite->flush_rules();
    }

    I've put the above code in my index.php file within my plugin. And every variation I've tried still returns a 404 error when I go to mydomain.com/mobile-admin/. Am I missing something? Any help is appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic