Thanks!
Okay, pulling it out of the admin_menu action worked. Thanks!
I am adding it under the admin_menu action directly in my function.php file.
add_action( ‘admin_menu’, ‘chbg_admin_menu’ );
function chbg_admin_menu() {
add_menu_page( ‘CHBG’, ‘CHBG’, ‘manage_options’, ‘chbg-admin’, ”, $icon, 40 );
acf_add_options_sub_page(array(
‘page_title’ => ‘Email Settings’,
‘menu_title’ => ‘Email Settings’,
‘parent_slug’ => ‘chbg-admin’,
));
}
I found the following method to hide the Gutenberg editor. (the solution at the bottom) https://github.com/AdvancedCustomFields/acf/issues/112
If there was a way to access the checkbox value for the Content Editor “Hide on screen”, then we could adapt the code to look for that value, instead of having to put in page names, but for now, I am Just hiding it on the home page.
That method does change the edit page back to the classic editor, so it hides the Content Area.
This would be great. I have a page builder and would love to hide some fields that I have on a tab now, but would love to have a tab-pop-up option so those fields are in a modal.
I too would love to see this feature. I have a page builder built with lots of repeaters, flexible fields, and this would really come in handy when editing a page.
Okay, this is odd but I was able to fix it simply by saving the post again. I checked this on another site and wasn’t having any issues so it must be something on this site, not the code.
You can remove this post if needed.
I got it working using a global variable. Thanks again.
I have a follow up question to this. Is there a way to set a pre-save variable and use it in the post-save action to allow me to compare the values and see what has changed?
Thanks, that was exactly what I was looking for.
I think I just did a work around. It’s been so long since that project that I am having a hard time remembering what I did. We can close this thread though.
I am STILL having this issue. I am using a script to populate the post meta data from an external source and about half the fields don’t show up until I physically edit the post and hit update but the values are showing in the fields. Any idea how to fix this?
Any ideas?
If I wanted to use this method outside of wordpress, what file would I need to include to pull in the update_field method?
I figured out a work around
$feature is the parent repeater field.
<?php $media = $feature['feature_media']; if($media): ?>
<div id="feature_media">
<?php
foreach($media as $key=>$row) {
$layout = $row['acf_fc_layout'];
if($layout == 'static_image'):
$image = $row['image'];
echo '<img src="'.$image['url'].'">';
elseif($layout == 'slideshow'):
$slides = $row['images'];
if($slides):
echo '<ul class="slides">';
foreach($slides as $slide) {
echo '<img src="'.$slide['url'].'">';
}
echo '</ul>';
endif;
elseif($layout == 'video'):
$embedcode = $row['embed_code'];
echo $embedcode;
endif;
} // end each row
?>
</div>
<?php endif; // end if media ?>
Not sure this is the right approach but at least it worked.
I am not seeing any errors in the console or the log.
This was an existing configuration that had Flexible Content. I added a choice to the Flexible Content field, added a couple of sub fields, put it second in the list of choices, and saved. After saving, most the existing content that was saved for other flexible content selections (layouts I guess) were missing. On the front end, it put in the rows, but the data is missing. It’s like when I added the field, it re-indexed the fields and broke the link to the data. I will try and restore the site again, and take screenshots along the way, then re-post.
We just recently added a Layout to one of our flexible field entries and it also broke our site. Most of the data isn’t accessible now from those layouts. I removed the layout I added and it didn’t resolve the problem. I restored the site from a backup, tried it again, and again, it broke the flexible fields. I think the fact that it re-ordered them, might have something to do with the issue because the couple layouts above the one I added are ok, it’s the existing layouts, now below the layout I added that are now gone, both Front end and Back End.
Yes, the images do exist and have IDs associated which is what we are populating the meta_value with. The post_meta table looks exactly the same after update, but for some reason, we physically have to hit update to make the repeater field recognize the data. That makes me think there is something somewhere else that needs to be updated.
The images even show up when in edit mode before hitting update, and in preview mode, just not on the front end page until after updating.
Any suggestions? I am at a loss. I have populated the database post_meta table to look exactly the same as if I had hit update and it’s still not showing up. I have also updated the post modified dates. Is there any other tables, information that needs to update for ACF to recognize the fields?
I will also add, we are doing the exact same thing for another repeater field and that one is working. The only difference being, we are storing postid (for images) in the one that isn’t working, and text data in the one that is. Since they are both arrays, I assume that shouldn’t matter.
No, we are dumping it directly into the database from an external source.
I am matching as far as I can tell what is being input after an update.
I am having a similar issue. I am importing data from an outside source to populate my meta data. They show up when editing, but not on the post until I update. I compared the post_meta data before and after the update and am adding the same fields that get added on save, but they still are not showing up until I physically hit update.
In my case it’s a repeater field and I have the following data
photo_slider
_photo_slider
photo_slider_0_photo
_photo_slider_0_photo
photo_slider_1_photo
_photo_slider_1_photo
etc….
What else am I missing. Is there something else I need to update for ACF to recognize the data for output?
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.