Last active
March 8, 2023 22:48
-
-
Save snrjosh/24c38e9a53e20cd537ac997461f34ca5 to your computer and use it in GitHub Desktop.
Change post_title and post_content Field Labels on ACF Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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