Hello,
I just tested it with ACF Fields, and it works too. See video of my test.
Have you tried to enable the WP_DEBUG
& WP_DEBUG_LOG
constants in wp-config.php
? Do you have any error in there?
Note that for your posts previously saved with “Performance Ultra”, you have to make sure that you converted back the metadata to normal meta, otherwise get_field()
will be empty, as shown in the demo video.
Performance Ultra meta are saved in the following format:
// 1 meta:
acf = array(
[textarea] => Fermentum fames turpis tellus dignissim vehicula.
[_textarea] => field_65490e56d9bf2
)
Normal ACF meta are saved in this format:
// 2 meta:
textarea = Fermentum fames turpis tellus dignissim vehicula.
_textarea = field_65490e56d9bf2
If you disabled the Performance Ultra without “rollback” the metadata to normal meta, it’s normal that your get_field()
don’t work anymore, as there is nothing that tells ACF to check the compressed acf
meta anymore.
So if your front template rely a lot on get_field()
, it might produce warning/errors on the posts that weren’t converted, and might render a blank page. Thus why it is important to check the PHP logs.
If you’re not really sure how meta are saved, I would recommend to enable the Developer Mode, so you can see your post metadata like in my video.
In order to rollback previous “Performance meta” posts into “Normal meta”, you’ll have to enable again the Performance Mode, with the “UI” setting, so you can choose to “rollback” your metadata. See documentation.
Note that the “UI” setting require the Developer Mode. Code usage:
add_action('acf/init', 'my_acf_init');
function my_acf_init(){
acf_update_setting('acfe/dev', true);
acf_update_setting('acfe/modules/performance', array(
'ui' => true, // enable ui (require dev mode)
'mode' => 'rollback' // pre-select "rollback" setting
));
}
Then head over your previous posts that were using Performance, make sure the “Rollback” setting is correctly checked in the sidebar, and update your post.
Here is a video demo showing this process with the example above. Once you converted all old posts, you can just remove the performance mode code.
Side note:
During my tests, I stumbled upon a bug with native ACF (without ACF Extended). When a new post is created with some ACF fields, and the status is changed to “Draft” from the “Quick Edit”, get_field()
will return empty values when the user click on the “Preview” link from the Post List.
To fix the issue, you have to edit the post and click either on “Save Draft” or “Preview” from the sidebar.
I don’t know if that issue is related to your problem, but it might be safe to always make sure to “Save draft” from the post edit screen, at least one time, before previewing the post.
Here is a video showing the bug with ACF only (ACF Extended is disabled).
Hope it helps!
Have a nice day!
Regards.