Hello,
i want to display a form in the frontend where the visitor can leave their names and all the names are displayed there. I created a CPT and used the title field for the name now when i display the frontend_form i want to rename the label of the title field into “Name” is this possible?
`$options = array(
“post_id” => “new_post”,
“post_title” => true,
“post_content” => false,
“return” => add_query_arg(“success”, “true”),
“new_post” => array(
“post_type” => “namebook”,
“post_status” => $post_status
)
);
acf_form($options);
Hi @mathishuettl
Yes, I think you can do that. Here’s an example how to change the title label on the front end:
function frontend_change_title_label( $field ) {
// Only do it on the front end
if( !is_admin() ){
// Check if the current field is post title
if( $field['name'] == '_post_title' ){
// Change the label
$field['label'] = 'Changed Title Label';
}
}
return $field;
}
// all
add_filter('acf/prepare_field', 'frontend_change_title_label');
I hope this helps 🙂