Please open a new support ticket on this here https://support.advancedcustomfields.com/new-ticket/
to know it it’s related to max_input_vars install this plugin https://wordpress.org/plugins/wp-max-submit-protect/. If there are too many inputs this plugin will pop up a warning telling you what you have it set to and how many you are attempting to submit.
according to what I can find, that is correct http://blog.netgloo.com/2014/09/28/creating-a-custom-widget-with-advanced-custom-fields-pro-in-wordpress/
This isn’t an inefficiency or ACF. It’s more of a problem with WP, although, that’s not really the case either. The problems are that your query is creating many, many joins doing multiple searches on a database column than is not optimized for searching.
This is explained in many places like https://wordpress.stackexchange.com/questions/158898/meta-query-terribly-slow and https://tommcfarlin.com/wp_query-and-multiple-meta-keys/.
There might not be a way to actually correct this, what follows is only a possible work around that has not been tested.
$ids = array_unique(array_merge($array1, $array2, $array3));
post__in
argument. You would only need to do your sorting by the date in this last query.Please submit bug reports by opening a new ticket here https://support.advancedcustomfields.com/new-ticket/
Does the page time out? What does it do exactly?
No problem on being a little snarky, I didn’t really notice that, just wanted to help in any small way I could. Glad you got your problem worked out.
I’m not completely sure how WC works in this case, but no, I don’t think acf_form() will help you.
Guessing that this is what’s happening
ACF fields have not been submitted yet, ACF does not run on the AJAX request, but if you use acf_form() it is still loading everything that it would normally load for field validation and detecting changes.
In order to use acf_form() you would need to:
There are a lot of pieces here and some of what needs to be done is unknown. For me, it would just be easier to hand code the form fields rather than use ACF form and then update the user ACF fields with those values using update_field(). The amount of work and code would be far less, not to mention the hours of testing that would be involved and possibly completely failing to get it to work since I’m not certain that it can be done.
I don’t know what that hook is or when it is called. If you want to run your function after ACF has saved values then you should be using acf/save_post https://www.advancedcustomfields.com/resources/acf-save_post/
I’m not seeing this when testing. It’s possible that it’s caused by a conflict with another plugin or your theme. Try deactivating other plugins and maybe changing themes to see if you can correct the problem. It may also be due to a PHP or JavaScript error during the AJAX request.
I gather from this that WC is submitting it’s form through AJAX. In that case I would add my own form fields to the WC form and then use the acf update functions like https://www.advancedcustomfields.com/resources/update_field/ to manually update the ACF user fields myself. When using these functions you should use the field key and not the field name to do the updates. You could also use update_user_meta() like in your example but you need to update the ACF field key reference in addition to the meta value, but it would be easier to use update_field using the field keys.
You would need to use php date functions to convert the date to what you need.
If you’re function is being called too early then what you need to do is have it called later. Is this a filter/action running on some WP hook?
If you can modify the code where the WC form is displayed you can use acf_form() with the form option set to false. You will also not be able to use the WC hook and you’ll need to create an acf/pre_save_post action https://www.advancedcustomfields.com/resources/acf-pre_save_post/ to do the work otherwise ACF will go ahead and save the values to the order no matter what you do in the WC filter, and all you’ll really need to do in the filter (i think, don’t hold me to this) is to return the ID for the user like.
// this is just a guess
$post_id = 'user_'.$user_id;
return $post_id;
The easiest way would be to create a file field and set the allowed file types to .pdf. This will only allow the editor to select pdf files from the media library.
If you want to do this the hard way you could https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/. You’ll need to do a query of the attachments to get all the pdf files to use to do the population. I’m not sure how you’d do this but this looks like it might do the trick https://wordpress.stackexchange.com/questions/22069/is-it-possible-to-query-specific-wordpress-attachment-files-ppt-pdf-and-ou
You’ve also go the wrong hook
<?php
function acf_mod_styles() {
?>
<style type="text/css">
.acf-repeater.-row>table>tbody>tr+tr>td,
.acf-repeater.-block>table>tbody>tr+tr>td {
border-top-color: #a8a8a8; // about twice as dark
}
</style>
<?php
}
add_action('acf/input/admin_head', 'acf_mod_styles');
?>
for block and row layouts
.acf-repeater.-row > table > tbody > tr+tr > td,
.acf-repeater.-block > table > tbody > tr+tr > td {
border-top-color: #000;
}
It may be that it was read, but that no one has read it that can help you. This is a users helping other users forum.
The best help that I can offer is to point you to additional documentation, there is a section on this page that covers adding mutliple markers near the end of the page. https://www.advancedcustomfields.com/resources/google-map/
There is also another post on it here, but it’s quite old so I don’t know if there’s anything in it that would be helpful https://support.advancedcustomfields.com/forums/topic/multiple-post-points-on-google-maps/
If there is a problem with the values being saved then it is probably https://www.advancedcustomfields.com/resources/limit-number-fields/
<?php
$value = get_sub_field('embed_iframe', false);
if (preg_match('/src="([^"]+)/', $value, $matches)) {
$url = $matches[1];
}
echo $url;
?>
Thanks for the explanation gummi, that sheds light on the add ons that do seem to be having a problem, like the image crop field that extends the image field, although that one also seems to be having an issue due to a change in the image field’s return value.
Fields on options pages must have unique field names and field keys. All values are stored in the option table.
I just tested this with several types of fields and I’m not having an issue deleting fields. Is it all fields or one field in particular? Can you supply more information of the field(s) that you cannot delete?
Creating a custom shortcode is not really an ACF subject, even if you’re using an ACF field to do it, which is why you’re not going to find any information on it on the ACF site or in any of the documentation.
This WP page has most of the information you’ll need on creating shortcodes https://codex.wordpress.org/Function_Reference/add_shortcode and you can find many tutorials on creating custom sortcodes.
One observation is that the first 3 lines of the code you posted should be inside of the function.
You said this is a select field? Is that the ACF field type or is the field actually a relationship or maybe a post object field?
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.