@decioy This should work…
<?php global $post; $args = array( 'post_type' => 'YOURCUSTOMPOSTTYPE', 'posts_per_page' => -1, 'post_status' => 'any' ); $myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post ); $custom_field_raw = get_the_content().get_field('YOURCUSTOMFIELD'); $custom_field_text_only = wp_strip_all_tags($custom_field_raw); $my_post = array( 'ID' => get_the_ID(), 'post_content' => $custom_field_raw // use $custom_field_raw if you want to keep any HTML formatting ); wp_update_post( $my_post ); endforeach; wp_reset_postdata(); ?>
PS: I recommend using $custom_field_raw instead of text_only if you want everything to look like it should.
Alright. Got it. Now I know not to try it.
I’ll use wp functions.
I investigated the reason of those not working. I can’t just use those wp functions on an Ajax called plugin. I must create a function and call admin-ajax.php in the js, also there must be an action with the name of the function that needs to run. I’ll try when I get the time I hope it works!
This is solved.
I think part of the issue is it saves (updates) all rows each times it saves. it doesn’t simply updates the ones that actually need it (new and modified rows).
If you could somehow hack the save function so it would only update what’s needed instead of every unmodified row it wouldn’t take that long to save the post. Is this possible or am i daydreaming?
Hello i just did a test.
I added a new sub field to my repeater.
And i noticed the default value exists for all OLD posts even though i did nothing.
I mean, not only on back end! which is expected.
I am displaying this brand new field and the default value is displaying correctly on the front end for old posts.
So i’m guessing at some point ACF changed since this is an ancient thread.
Is it correct?
Are you now applying new fields default values retroactively? If that’s the case AWESOME!
What’s the official status on object-cache with ACF? I see treads dating back from 2012 people systematically asking for embracing the feature. it seems like it was implemented at some point but never really working properly.
Was this OP issue ever fixed, what’s the general status?
I’d love to be able to use WP-Redis.
I don’t use medium size since i don’t need it for anything, i save several GB of storage doing this.
I only use 150×150 and real size.
I guess the suggestion is to fallback to thumbnail if medium doesn’t exist and only then to full size.
EDIT: I realized that what i’m describing is called a lightbox, gonna have to look elsewhere for this functionality.
I think the required switch shouldn’t be overridden by anything.
I mean that’s the whole point 1 switch to decide if the field is required or not.
The way you have it now it’s a worthless, I can’t choose to have a gallery as “not required” and a minimum of pictures for those who decide to use it.
i have to set it as “Not required” and also set the minimum to 0. Else it will not validate. See the issue? I just lost control of the minimum images number.
And useful button should behave like this:
-> Is the field required?
-YES: Are images in min-max range? (+other checks)
-No: Don’t validate.
That overriding is wrong. If you want to make it required, flip the switch to ON. Don’t deny control to the rest of the users.
Yeah, no. all the info is scattered around the default wysiwyg editor and i have to move it to like 6 different ACF. Just making sure i’m not doing it the dumb way. I thought maybe some regular expressions and programming could help allocate things faster. I think most people that use ACF start the project doing so, they don’t realize they need it 3 years later like me. Sucks for me. Thanks for clarification!
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!
© 2020 Advanced Custom Fields. Subscribe