How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?

The problem is that when the special subscriber tries to Add New a sub-cpt post, it is denied permission. However, when the CPT menu is a top-admin-menu, then everything works out fine. The issue is related to the placement of the CPT’s UI menu in the back-end: if it’s top-level (show_in_menu=TRUE), all is well; if … Read more

similar to Editor can create any new user except administrator

Simple all you need to do is edit this part of the code : function editable_roles( $roles ){ if( isset( $roles[‘administrator’] ) && !current_user_can(‘administrator’) ){ unset( $roles[‘administrator’]); } return $roles; } and change it to function editable_roles( $roles ){ //don’t change anything if current user is admin if (current_user_can(‘administrator’)) { return; }else{ if( isset( $roles[‘administrator’] … Read more

Add Role inherits?

You must set to true for them to take affect. If you do not specify true they all default to NULL which in turn basically makes them false. So to create a roll that allows pages only: add_role(‘page_editor’, ‘Page Editor’, array( ‘read’ => true, ‘edit_others_pages’ => true, ‘edit_pages’ => true, ‘edit_published_pages’ => true, ‘delete_pages’ => … Read more

Can’t manage to make translate_user_role() work

I think your function nesting is slightly muddled; call ucfirst after translating, like so: esc_html( ucfirst( translate_user_role( $user->roles[0] ) ) ); My bad, completely skipped a beat there. You should instead be using: translate_user_role( $GLOBALS[‘wp_roles’]->role_names[ $user->roles[0] ] ); It’s unreliable to assume that all role display names are simply ucfirst( $role key ). If that … Read more

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