This saved my life. All my ACF went crazy and stopped existing unless i manually update each post. I had to use this to display the data from the database.
Now i need guidance for the gallery field (wishful thinking). =S
Holy!
This is still happening after 6 years?
@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.
Unless you are doing some sorting by meta, there’s no reason for fields to be stored in wp_postmeta. I’m gonna try this solution on a test site. Thanks @cr101
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?
You don’t even need ACF to do that, you can edit your site’s template to display whatever you want.
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!
Any progress on this front? The silence is terrifying.
Please ACF team address issues with object-cache.
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.
It would be cool but since the problem is my own fault i won’t peruse any change, thanks for the answer.
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.
Thanks.
This flexslider works fine but what would really be great is if it showed the image bigger (90/100% of the screen size) when clicked. maybe someone who understands JavaScript can attempt it?
EDIT: I realized that what i’m describing is called a lightbox, gonna have to look elsewhere for this functionality.
Gotcha, you are right, i’ll prolly do individual files for each cpt and do template parts for the similar bits thanks!
Done thanks.
PS: There’s a typo on that email address 😛
Hi OK! That’s great how can i send you credentials privately?
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?
-NO: Validate.
-YES: Are images in min-max range? (+other checks)
-YES: Validate.
-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.
I see, well no it’s kinda messy there are no classes just plain text it would be very complicated and unreliable. Time to sit and suck it up for a while. Cheers!
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!
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.