Why is my Custom Post Type not showing up after adding capabilities?

You have to register custom capabilities and then apply inside the register post type function function register_website_caps() { $admins = get_role( ‘administrator’ ); $admins->add_cap( ‘edit_website’ ); $admins->add_cap( ‘read_website’ ); $admins->add_cap( ‘delete_website’ ); $admins->add_cap( ‘edit_websites’ ); $admins->add_cap( ‘edit_others_websites’ ); $admins->add_cap( ‘publish_websites’ ); $admins->add_cap( ‘read_private_websites’ ); } add_action( ‘admin_init’, ‘register_website_caps’); // Creating the website post type function … Read more

Filter list of rules based on a capability

Untested, but should be easily extendable(or something you can take ideas from). function roles_have_cap( $roles = false, $cap ) { global $wp_roles; if( !isset( $wp_roles ) || !isset( $cap ) ) return false; if( !$roles ) $roles = array_keys( $wp_roles->roles ); if( !is_array( $roles ) ) $roles = array( $roles ); $hascap = array(); foreach( … Read more

Remove wordpress author’s capability to moderate comments on their own posts

From quick look at code the likely permissions check for that is edit_comment capability in edit_comment() function. Your options to remove that capability roughly are: customize the role with plugin, for example Members customize role with code, probably using remove cap functionality filter thiungs around map_meta_cap or user_has_cap if you need to achieve more elaborate … Read more

current user can edit user?

Yes it can be good practice to check if a user is capable of doing something before doing something related in code. For example, don’t save a custom post type if the user doesn’t have the capabilities needed to do it, or don’t show certain things to users who don’t have the manage_options capability ( … Read more

Trouble adding JavaScript in visual editor (Sharpspring embed code)

You need the unfiltered_html capability to write JavaScript in post content. This is granted by default to administrators and editors. The better way would be to write a small plugin that provides you a shortcode: <?php /** * Plugin Name: WPSE 234978 – Provide shortcode for Sharpspring embed * Plugin URL: http://wordpress.stackexchange.com/q/234978/31323 * License: MIT … Read more