remove_cap example

function upgrade_440() {
    global $wp_current_db_version$wpdb;

    if ( $wp_current_db_version < 34030 ) {
        $wpdb->query( "ALTER TABLE {$wpdb->options} MODIFY option_name VARCHAR(191)" );
    }

    // Remove the unused 'add_users' role.     $roles = wp_roles();
    foreach ( $roles->role_objects as $role ) {
        if ( $role->has_cap( 'add_users' ) ) {
            $role->remove_cap( 'add_users' );
        }
    }
}

/** * Executes changes made in WordPress 4.5.0. * * @ignore * @since 4.5.0 * * @global int $wp_current_db_version The old (current) database version. * @global wpdb $wpdb WordPress database abstraction object. */


    /** * Removes a capability from a role. * * @since 2.0.0 * * @param string $cap Capability name. */
    public function remove_cap( $cap ) {
        unset( $this->capabilities[ $cap ] );
        wp_roles()->remove_cap( $this->name, $cap );
    }

    /** * Determines whether the role has the given capability. * * @since 2.0.0 * * @param string $cap Capability name. * @return bool Whether the role has the given capability. */
    public function has_cap( $cap ) {
        
Home | Imprint | This part of the site doesn't use cookies.