Title: Access plugin php using wp-admin/admin.php url
Last modified: May 11, 2021

---

# Access plugin php using wp-admin/admin.php url

 *  [skydev2020](https://wordpress.org/support/users/skydev2020/)
 * (@skydev2020)
 * [5 years ago](https://wordpress.org/support/topic/access-plugin-php-using-wp-admin-admin-php-url/)
 * I have the plugin with folder/files and I am using the plugin in admin dashboard.
   
   Folder: views actions.php client_register.php
 * And I created one menu like this
 *     ```
       add_submenu_page("custom", "Client Registration", "New Client Site",'manage_options', "client_register", 'page_client_register');
   
       if ( ! function_exists( 'page_client_register' ) ) {
           function page_client_register(){
               render_page_client_register();
           }
       }
       ```
   
 * And I am able to call the `page_client_register`function (which is actually a
   independent php file) like this.
    `http://127.0.0.1/wp-admin/admin.php?page=client_register`
   This is possible because I created the menu.
 * How can I access other files similar to that way?
    using `wp-admin/admin.php`
   url
 * If I directly call the files like `http://127.0.0.1/wp-content/plugins/<pluginname
   >/views/actions.php` it says Direct PHP ACCESS is not allowed in some cloud sites.
 * How can I access these files using `wp-admin/admin.php`?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years ago](https://wordpress.org/support/topic/access-plugin-php-using-wp-admin-admin-php-url/#post-14425671)
 * You cannot, at least not that way. If you want to directly access your PHP files
   and they rely upon WP resources, you could route requests through /wp-admin/admin-
   post.php. Despite the name, it’ll work for GET requests too.
 * For GET, include an `action` query string in the URL, whose value is used to 
   compose an action hook handle that fires with the request. Add a callback function
   to that action hook. The callback can include or require other .php files. Review
   the file’s source code for better understanding on how this works. It’s relatively
   short and simple in what it does.
 *  Thread Starter [skydev2020](https://wordpress.org/support/users/skydev2020/)
 * (@skydev2020)
 * [5 years ago](https://wordpress.org/support/topic/access-plugin-php-using-wp-admin-admin-php-url/#post-14427405)
 * [@bcworkz](https://wordpress.org/support/users/bcworkz/) Thanks for your explanation,
   I have experience in using `action` query string in the URL but I have never 
   thought it is related to hook.
    Thanks I will use action. Btw can you give me
   more info how to create route through /wp-admin/admin-post.php
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years ago](https://wordpress.org/support/topic/access-plugin-php-using-wp-admin-admin-php-url/#post-14431498)
 * More info can be found here: [https://glennmessersmith.com/pages/wpenviro.html#useapost](https://glennmessersmith.com/pages/wpenviro.html#useapost)
 * Use of admin-post.php isn’t very well documented in WP docs. The dynamic CSS 
   bit in the linked document of course does not apply to your situation, but the
   action hook section could be applied to anything.
 *  Thread Starter [skydev2020](https://wordpress.org/support/users/skydev2020/)
 * (@skydev2020)
 * [5 years ago](https://wordpress.org/support/topic/access-plugin-php-using-wp-admin-admin-php-url/#post-14431975)
 * [@bcworkz](https://wordpress.org/support/users/bcworkz/) Thank you, it makes 
   very clear now.
    Regards

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Access plugin php using wp-admin/admin.php url’ is closed to new replies.

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [dashboard](https://wordpress.org/support/topic-tag/dashboard/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 3 participants
 * Last reply from: [skydev2020](https://wordpress.org/support/users/skydev2020/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/access-plugin-php-using-wp-admin-admin-php-url/#post-14431975)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
