1. Home
  2. Car Demon Code Docs
  3. Admin Filters
  4. cd_cap_settings_filter

cd_cap_settings_filter

This filter is used to modify the capabilities needed to edit or update parts of the vehicle data. By default the capability “edit_posts” is used.

apply_filters( ‘cd_cap_settings_filter’, $cap_settings );

add_filter( 'cd_cap_settings_filter', 'my_caps', 10, 1 );
function my_default_caps( $cap_settings ) {

    $cap_settings['price'] = 'manage_options';

    return $cap_settings;
}

In the above example we change the capability needed to update the vehicle price to “manage_options” which is generally associated with an Administrator user level. With this change only users with the “manage_options” capability can change prices.

NOTE: This change bypasses the default values or any changes made in the settings area. Any changes to the settings will be ignored and this will take precedent.

Was this article helpful to you? Yes No

How can we help?