Skip to content

Instantly share code, notes, and snippets.

@snrjosh
Last active March 8, 2023 22:48
Show Gist options
  • Save snrjosh/24c38e9a53e20cd537ac997461f34ca5 to your computer and use it in GitHub Desktop.
Save snrjosh/24c38e9a53e20cd537ac997461f34ca5 to your computer and use it in GitHub Desktop.
Change post_title and post_content Field Labels on ACF Form
<?php
/**
* https://www.advancedcustomfields.com/resources/acf_form/
*
* Modify ACF Form Post Title Field Label
* @ default 'Post Title'
*/
function acf_form_post_title_label( $field ) {
if ( is_page( 5 ) ) { // form on page ID 5.
$field['label'] = 'Product Name';
}
return $field;
}
add_filter( 'acf/load_field/name=_post_title', 'acf_form_post_title_label' );
/**
* Modify ACF Form Post Content Field Label
* @ default 'Post Content'
*/
function acf_form_post_content_label( $field ) {
if ( is_page( 5 ) ) { // form on page ID 5.
$field['label'] = 'Product Description';
}
return $field;
}
add_filter( 'acf/load_field/name=_post_content', 'acf_form_post_content_label' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment