How to Remove Vehicle Attributes/Fields from Vehicle Details Page?
In some cases, if you want to remove/hide some attributes from the vehicle details page, you can do it by hooking the custom function to the “cardealer_car_attributes” filter hook. It is the same filter hook used above to add custom fields in the vehicle items.
Here is the sample code to remove/hide attribute/field from the vehicle details page.
function cardealer_child_remove_car_attributes_and_fields( $attributes, $post_id ){ // Debug This // Set "$debug_this" true, to display full list of available data (including attributes/fields). $debug_this = false; if( $debug_this ){ echo '<pre>'; print_r($attributes); echo '</pre>'; exit; } // Prepare array of the attributes/filds, which you want to remove. // Here below, we added keys of the Stock Number and Vin Number data to remove them from vehicle details page. $removable_attributes = array( 'car_stock_number', 'car_vin_number', ); foreach ( $attributes as $taxonomy_k => $taxonomy_v ) { if ( in_array( $taxonomy_v, $removable_attributes ) ) { unset( $attributes[ $taxonomy_k ] ); } } return $attributes; } add_filter( 'cardealer_cars_details_attributes_array', 'cardealer_child_remove_car_attributes_and_fields', 20, 2);
We assume that you are using the child theme for the customizations and adding the above code in the child theme’s functions.php. You can find the child theme in the theme package downloaded Themeforest.