Custom site role cannot access Appearance menu

WP Custom Site Roles appear to be a bit ‘flaky’ at best but this particular solution worked for me (created a custom plugin for it). $result = add_role( ‘org_site_owner’, __( ‘Site Owner’ ), array( ‘activate_plugins’ => false, ‘create_users’ => true, ‘customize’ => true, ‘delete_others_pages’ => true, ‘delete_others_posts’ => true, ‘delete_pages’ => true, ‘delete_plugins’ => false, … Read more

Why are all roles assigned to a user when using wp_insert_user()?

You need to update the user straight after they have been created. So yes, by default they get all then you update. wp_update_user( array (‘ID’ => $user_id, ‘role’ => ‘user_role_here’) ); The above should fix this issue. Obviously changing the $user_id to your style of ID and also user_role_here to editor or alike. Thanks, Tom

dynamic home page according to role user

$query->is_home() is not, well, ‘home’. $query->is_home() checks of you are viewing the blog/posts page. It’s an artifact from when the home page of WordPress sites was invariably the blog. You want to change that to $query->is_front_page(), which checks if the front page of the website is a page, and if you are on that page.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)