I’m using a plugin to crawl products from other sites and save it as draft products. With the crawling I add custom fields, but If I publish all products with the bulk option some field doens’t display, the only solution I found is open and publish one by one, but I lost a lot of time because there’re hundreds….
Is there some code to update all custom fields from draft products?
My ACF version is 5.6.10.
I use a plugin called Content Crawler that copy products from other stores and publish it on my site. There’re many options, for example how to get titles, content, images, etc, and one of this options is to add post meta key, that I’m using with the ACF plugin. My problem is that some fields are only displayed when I save and publish the post, but no if I publish directly after crawling. For example:
Example 1: Select field called “games” is displayed if the post is published directly with this code:
<?php if( get_field('games') == 'option1' ): ?> <a href="https://www.site.com/games/option1/">Option 1</a> <?php endif; ?>
Example 2: Select field called “company” isn’t displayed if the post is published directly with this code:
<?php $field = get_field_object('company'); $value = get_field('company'); $label = $field['choices'][ $value ]; echo $label; ?>
Example 3: Text field called “source” isn’t displayed if the post is published directly with this code:
<?php echo the_field('sources'); ?>
In summary, I have draft products created with a crawling plugin that contains meta-keys, and this meta-keys are only displayed when I open each draft product one by one and publish it, If I publish directly without open it or select multiple draft products and I the bulk option to publish it, the fields aren’t displayed. I hope this explanation will be more understandable, sorry for my bad English.
The problem is that this plugin is probably not away built to work with ACF and some field types will not work properly. When ACF stores a meta value it also saves a second value that holds the field key reference of that field. This field key reference is what ACF uses to figure out how the value is stored and what it needs to do to return it correctly. Some fields without this reference will work and these are the simple/basic fields. This is why some fields appear to work and why some don’t and why they work after manually updating the post.
The topic ‘Problem save meta values’ is closed to new replies.
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!