Hey all… back again with part 2 of my acf_form() tutorial… this time with front end post editing. Super powerful stuff here.
Check it out:
http://thestizmedia.com/front-end-post-editing-with-acf-pro/
@JiveDig Is it possible to use the same acf/pre_save_post filter for 2 acf_form that are on 2 different page templates? I can create a new post but I can’t Edit an existing post. You can see my question here: http://support.advancedcustomfields.com/forums/topic/acf_form-not-creating-new-post/
The Edit Post page loads the ACF Fields but the update only updates the ACF Fields and does not edit the Post Title and Post Content.
Any ideas how to fix this?
I don’t think pre_save_post will work here. If you see my tutorial, I need to run load_value then wp_update_post to update the title/content.
@JiveDig Thanks for the reply. I’m rethinking my needs for this project. All I need to save is the Post Title and Post Content which is really simple to do with v5 acf_form. What I want is to use a “Basic” wysiwyg editor and remove the ability to upload media.
Based on This Post, it looks as it might be possible using the acf/get_valid_field
or acf/get_valid_field/type=
functions.
Even though the following code is not valid, this is my thought process:
if( $field['type'] == 'wysiwyg' ) {
$this->defaults = array(
'toolbar' => 'basic',
'media_upload' => 0
)
}
Any ideas?
I just found the solution to my problem. Here is the working code:
// Change Post Content Type
add_filter( 'acf/get_valid_field', 'change_post_content_type');
function change_post_content_type( $field ) {
if($field['type'] == 'wysiwyg') {
$field['tabs'] = 'visual';
$field['toolbar'] = 'basic';
$field['media_upload'] = 0;
}
return $field;
}
The topic ‘Front end post EDITING with ACF Pro’ is closed to new replies.
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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.