0

I want to add a new role for all subsites in WPMU, so I created a file and tried the famous code on it (after including wp-blog-header.php):

$result = add_role(
    'ret_moderator',
    'مدیر بازنشسته',
    array(
        'read'         => true,  // true allows this capability
        'edit_posts'   => true,
        'delete_posts' => true, // Use false to explicitly deny
        'delete_published_posts' => true,
        'publish_posts' => true,
        'upload_files' => true,
        'read_private_pages' => true,
        'read_private_posts' => true,
        'edit_published_posts' => true,
        'edit_pages' => true,
        'manage_categories' => true,
        'manage_links' => true,
        'list_users' => true
    )
);

It adds the role for the main blog, but it's invisible on the sub-sites :) My own idea is to place the code inside somewhere like themes and open it on sub-sites (:D) but you know that isn't standard approach.

1 Answers1

0

The problem is that you placed it in the theme of the main blog.

For it to run on all blogs you should create a plugin for wordpress, place your code there and than enable it to the entire network (from the super admin panel).

Good luck :)

Eliran Efron
  • 621
  • 5
  • 16
  • isn't that possible without creating a plugin? :D – Mohammad Teimori Pabandi Feb 04 '14 at 15:54
  • if you activate the same plugin for the all network or add it to every theme that is running on the network... the thing is that settings such as these can only be performed by a plugin or a theme. but the beautiful thing about MultiSite is that you can activate a plugin for the entire network while in each site it won't be visible at all ! it's like a basic feature of the system. that's why i recommended to build a plugin :) – Eliran Efron Feb 04 '14 at 16:55