Title: API to create access levels
Last modified: October 15, 2019

---

# API to create access levels

 *  Resolved [canlasjp](https://wordpress.org/support/users/canlasjp/)
 * (@canlasjp)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/api-to-create-access-levels/)
 * First of all, thanks for a great plugin.
 * Is there a way to programmatically create access levels through an API call? 
   Please send out a sample on how to do this. Thanks.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/api-to-create-access-levels/#post-12052244)
 * I am glad you find the plugin useful!
 * There is no official API to create a new level, but since a level stored as a
   custom post type, you can use wp_insert_post like this:
 *     ```
       wp_insert_post(array(
           'post_title' => 'Title'
           'post_type' => 'restriction',
           'post_status' => 'publish'
           ...
       ))
       ```
   
 * See all arguments here: [https://developer.wordpress.org/reference/functions/wp_insert_post/](https://developer.wordpress.org/reference/functions/wp_insert_post/)
 * I hope this helps!

Viewing 1 replies (of 1 total)

The topic ‘API to create access levels’ is closed to new replies.

 * ![](https://ps.w.org/restrict-user-access/assets/icon-256x256.png?rev=1815922)
 * [Restrict User Access - Ultimate Membership & Content Protection](https://wordpress.org/plugins/restrict-user-access/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-user-access/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-user-access/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-user-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-user-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-user-access/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/api-to-create-access-levels/#post-12052244)
 * Status: resolved