To white-label Advanced Custom Fields (ACF) in WordPress, you can use the acf/settings/show_admin
filter to customize the ACF admin menu and hide the ACF branding. By setting this filter to false
, you can remove the ACF logo and branding from the admin menu.
Here’s an example code snippet that you can add to your theme’s functions.php
file to white-label ACF:
function wpsnippets_hide_acf_branding() {
return false;
}
add_filter('acf/settings/show_admin', 'wpsnippets_hide_acf_branding');
This code snippet will remove the ACF branding from the admin menu, providing a white-label experience for your clients or users.
Use case: This code snippet is useful when you want to customize the ACF admin menu and remove the ACF branding to create a more personalized experience for your clients or users. It allows you to present ACF as a seamless part of your WordPress website without any external branding.
Examples
Example 1: Customizing ACF Plugin Name and Menu Label
This example demonstrates how to customize the plugin name and menu label for Advanced Custom Fields (ACF) using the acf/settings/info
filter.
function wpsnippets_acf_custom_labels( $info ) {
$info['name'] = 'Custom ACF';
$info['menu']['title'] = 'Custom ACF';
return $info;
}
add_filter( 'acf/settings/info', 'wpsnippets_acf_custom_labels' );
In this code example, we define a custom function wpsnippets_acf_custom_labels
that modifies the plugin name and menu label for ACF. We use the acf/settings/info
filter to hook into ACF and update the values. The function returns the modified $info
array, which includes the updated plugin name and menu label.
Example 2: Customizing ACF Field Group Label
This example demonstrates how to customize the label for an ACF field group using the acf/field_group/title
filter.
function wpsnippets_acf_custom_field_group_label( $title ) {
return 'Custom Field Group Label';
}
add_filter( 'acf/field_group/title', 'wpsnippets_acf_custom_field_group_label' );
In this code example, we define a custom function wpsnippets_acf_custom_field_group_label
that modifies the label for an ACF field group. We use the acf/field_group/title
filter to hook into ACF and update the $title
variable. The function returns the custom field group label.
Example 3: Customizing ACF Field Label
This example demonstrates how to customize the label for an ACF field using the acf/prepare_field
filter.
function wpsnippets_acf_custom_field_label( $field ) {
$field['label'] = 'Custom Field Label';
return $field;
}
add_filter( 'acf/prepare_field', 'wpsnippets_acf_custom_field_label' );
In this code example, we define a custom function wpsnippets_acf_custom_field_label
that modifies the label for an ACF field. We use the acf/prepare_field
filter to hook into ACF and update the $field
array. We modify the label
key of the $field
array to set the custom field label. The function returns the modified $field
array.