Home › Forums › ACF PRO › Front end form,how to change post_title and post_content properties › Reply To: Front end form,how to change post_title and post_content properties
I think the easiest way for you to achieve all of these is to create your own custom fields for the title and the editor. You can then hook into the
acf/save_post action hook and retrieve the values in these fields yourself and add them as the post title and post content.
A few things to note:
1. You have to run the remove_action before saving the post title and content (if you save them using wp_update_post) and add it back in after. Basically same thing as this explains with infinite loops except you apply it to acf/save_post: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
2. You’re gonna end up with two extra fields in the admin area for these title and content fields. You can remove them in the admin area using CSS or simply disable them (to stop user from being able to interact with them) using this filter: https://www.advancedcustomfields.com/resources/acfload_field/
$field['disabled'] = 1;
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.