@joelstransky Tried your last code and her is what happened:
-it created 3 revisions? only the first one has the changes, the other 2 didnt hold the meta
– It through errors few times, the first was a loop of all the feilds like this:
Notice: Undefined index: field_55fee582b1b7e in F:\EasyPHP-12.1\www\hot\wp-content\themes\hand-theme\functions.php on line 111
and last line error was:
Warning: Cannot modify header information – headers already sent by (output started at F:\EasyPHP-12.1\www\hot\wp-content\themes\hand-theme\functions.php:111) in F:\EasyPHP-12.1\www\hot\wp-includes\pluggable.php on line 1171
the line:111 is this (of your code):
update_field($field_name, $_POST['acf'][$v], $revision_id);
-Finally I got simller error to the one I got when using the code+plugin
version in F:\EasyPHP-12.1\www\hot\wp-content\plugins\advanced-custom-fields-pro\core\revisions.php on line 272
Hops that helps.
I’ve tested the plugin, and did a small changes to make it loop through all the meta fields in the post “I have many”
function add_meta_keys_to_revision( $keys ) {
$fields = get_fields();
$count=0;
if( $fields )
{
foreach( $fields as $field_name => $value )
{
$field = get_field_object($field_name, false, array('load_value' => false));
$keys[$count] = $field_name;
$count++;
}
}
return $keys;
}
add_filter( 'wp_post_revision_meta_keys', 'add_meta_keys_to_revision' );
it works fine, however im getting error in the revision page
version in F:\EasyPHP-12.1\www\hot\wp-content\plugins\advanced-custom-fields-pro\core\revisions.php on line 272
also I noticed I have 2 revision every time i make a modification one with no meta-data and the other with.
I hove the next update will have a fix for this old bug based on this plugin
Yes, or the group of fields, actually anything can tells me there is an update, add/remove happened
Sorry for the late replay, I had exams.
Well, I don’t think what I want is possible to make it into add-on because it consist of multiple field types including a default one.
Thanks for your help anyway.
Hi, I believe i’m doing both!
I want to create an add-on for AFC to create a new field type, however when you assign that new field to a (eg. post), I need to show a repeater (per-defined) of a new field type and use it’s values to create a custom front-end output.
– To give an example, I want to create a calendar plugin, that can be assigned to any post type.
– It will have a repeater to add events (repeater of text(title), date&time(the new field type) )
– Then in the output will show the calendar with its events
At the moment I have done that by creating theme templates, CPT and exporting ACF code inside the theme, which is utilizes ACF as you said.
Hi Jonathan,
After some testing I found that the second function is doing nothing!, everything going through the broken function (inc the status of a new post!), so i removed it.
now this is what I have in function.php using the codex link u posted
works perfectly fine
//for new and updated post status
add_action( 'acf/save_post', 'update_existing_post_data', 10 );
function update_existing_post_data( $post_id ) {
if ( ! wp_is_post_revision( $post_id ) ){
// unhook this function so it doesn't loop infinitely
remove_action('save_post', 'update_existing_post_data');
// Update existing post
$post = array(
'ID' => $post_id,
'post_status' => $_POST['acf']['field_55dd90c79e8a6'],
);
// update the post, which calls save_post again
wp_update_post( $post );
// re-hook this function
add_action('save_post', 'update_existing_post_data');
}
}
Please if you can see anything wrong with this point it out as this is not the first time I need to change this part again!.
Amazing I didn’t know about it!. thanks
Thanks, Ill be waiting for that so badly.
Forcing revision didn’t help saving the the ACF in the revisions, still only the title + content. In the link you posted there is someone having the same bug! lets hope the developer can patch this soon.
I recommended this plugin for my organization as the best solution for our websites, hopefully this wont fail me that quick 🙁
Thanks for the link, ill go through it and see if I can find a way.
Do I need to report this bug ? or the developers aware of it now ?
Thanks, Please let me know on this as it is essential matter in my project and waiting for this.
If there is way to force WP to revision the post I would love to know it.
Thanks
Great thanks,
Is it possible to point me to some tutorials/example on what I need to do please. Im confused :\
What is the right hook to call “acf_form” with ? the only one that worked for me is “the_content”, but it load the form before the post!. is it possible to make editing a post happens if a different page?
Also, I cant figure out how to do the “Save and continue later”, the post hide as soon as I save it as draft or pending….
Thanks John, I think I know what I need to decide now 🙂
Thank John,
For number 3, can I do something like letting a group of users can edit specific posts based on some “custom” data in there profile managed me the admin “maybe”. Or any other solution for this matter.
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.