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

cd_cap_default_settings_filter

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

apply_filters( ‘cd_cap_default_settings_filter’, $cap_settings );

add_filter( 'cd_cap_default_settings_filter', 'my_default_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 changes the default value in the settings area. This value can still be changed and updated in the settings area by anyone who has access to Car Demon settings.

Was this article helpful to you? Yes No

How can we help?