current_user_can( ‘edit_post’, $post_id ) does not work for contributer but for administrator

using map_meta_cap I added edit_post per post cap to user function my_map_meta_cap( $caps, $cap, $user_id, $args ){ if ( ‘edit_post’ == $cap ) { $post = get_post( $args[0] ); $post_type = get_post_type_object( $post->post_type ); $caps = array(); if ( $user_id == $post->post_author ) $caps[] = $post_type->cap->edit_posts; else $caps[] = $post_type->cap->edit_others_posts; } return $caps; } add_filter( … Read more

Menu capability in WordPress

Capability parameter of add_submenu_page() function can only take a single capability, so if you are using the built in roles you can select a capability fro the long list that both administrators and editors have any of these (use any of these freely): moderate_comments manage_categories manage_links unfiltered_html edit_others_posts edit_pages edit_others_pages edit_published_pages publish_pages delete_pages delete_others_pages delete_published_pages … Read more

What exactly is WordPress?

Yes, you can run WordPress with your own domain if you purchase hosting for it. WordPress has system of Roles (which can be further enhanced via plugins), you can let users register and allow to perform actions accordign to their role. Essentially yes. You copy WordPress files to server and initiate brief installation procedure. First … Read more

What’s the difference between Role and Meta capabilities; When to use map_meta_cap() filter

difference between Role and Meta capabilities That would be better to ask the compare Role with Capabilities, not just Meta capabilities, but as a simple answer: A Role defines a set of tasks a user assigned the role is allowed to perform. Capabilities are assigned to Roles difference between Meta and Primitive capabilities? Meta capabilities … Read more

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