Support » Developing with WordPress » How to create my own custom permisssion like purge_varnish, purge_varnish_conf

  • Hi Someone,

    I am looking for help to create my own permission. How could i do it, Please suggest and share the doc/article.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Devendra

    I think you mean create your own capability, you have to use add_cap

    $role = get_role( 'author' );

    Then you have to check if the user or role has this capability:


    Thread Starter Dsingh


    Thanks Luis,

    I got it.

    I have one more question. How could i alter any plugin form?

    Hi Devendra

    Every plugin is different, some plugins let you change their forms, others don’t.

    Which plugin do you need to change?

    Thread Starter Dsingh


    Thanks Luis,

    I was looking for every form. I am a Drupal developer where it is possible.

    I have another question. Are menu permissions are tightly coupled with plug-in.

    Means can i change the menu permissions by overtiring the same menu in my plugin.
    For example.

    function nimble_menu() {
    $page_title = ‘Export Contact Form (Save CF7)’;
    $menu_title = ‘Export Contact Form ‘;
    $capability = ‘export’;
    $menu_slug = ‘save_contact_form_7’;
    $function = ‘nimble_populate_page’;
    $icon_url = plugins_url(‘save-contact-form-7/assets/images/icon.png’);
    $position = 99;
    //create new top-level menu
    add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position);
    $menu_slug, // admin page slug
    ‘Export Contact Form (Save CF7) settings’, // page title
    ‘Settings’, // menu title
    ‘manage_options’, // capability required to see the page
    ‘nimble_settings’, // admin page slug, e.g. options-general.php?page=wporg_options

    Could i overwrite this menu in my custom pluing with the another permission (e.g export)

    I assume you are using Contact Form 7 but I don’t know what do you want to do exactly.

    Why do to need permissions, menus and forms. I know a little bit of Drupal, perhaps you try to do things in Drupal way and you need a different approach.

    Thread Starter Dsingh


    Thanks Luis for your quick support.

    Basically Contact Form 7 have the manage_options permissions on their menus. I want to allow a role to export permissions on that menu.

    Can you please suggest? How could i achieve?

    You mean in the WP dashboard? You want some new role to access to Contact Form 7 menu, don’t you?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to create my own custom permisssion like purge_varnish, purge_varnish_conf’ is closed to new replies.