Forum Replies Created

  • Hello, this is kind of old, but I am looking for the same thing and the solution above is not working for me. I don’t know if something changed with later versions, but is there a working solution for the latest ACF version?

  • Hello, a bit of an old post, but I am facing the same issue. I am running the function using ‘load_field’ and although the field is set as ‘not required’ and this is reflected on the output html, after submitting the form I can still see an error.

    function acf_classified_date_required_change( $field ) {
      	$field['required'] = false;
    	return $field;
    add_filter('acf/load_field/name=classified_date', 'acf_classified_date_required_change');
  • Thanks again for your interest John!

    Actually, I found my way through this problem and sharing here, in case it helps anyone.

    Since I wanted this map to be set globally from the header, then it would require the acf_form_head() to be always loaded.

    It took some effort, but I ended up with this solution:

    – Created a separate page
    – Added the google map form and styled it to stretch and occupy the whole screen
    – Hid all other elements (header, footer, etc)
    – Loaded the above page with jquery as an iframe and styled the iframe itself to look like a modal
    – After the form submission I look for the $_GET[‘updated’] and if true, I load an inline script to remove the modal

    This way, I don’t need to leave my current page, nor do I have to lead the acf_form_head() where not needed.

  • John.. or anyone else…?

    Is there a way to strip acf_form_head() down to the basics required just for google map? Because it loads all kinds of things like datepickers, etc, etc..?

    I managed to make the functionality required, but I find it to be too heavy loading all this stuff. :/

  • John, thank you for the fast reply.

    So, you suggest that it would be safe to use acf_form_head() inside header.php?

    What would happen in cases where the map could be on top of a page that already includes its own form?

    The AJAX solution seems interesting, but it comes after resolving the main issue.

  • Thank you John, you have been an invaluable member of this forum!

  • …Actually, my code was correct and I had mis-spelled the meta_key name!

    I apologize about this, but I was using trial-and-error for a couple of hours trying different stuff, that should be working.

    Hopefully this thread also helps someone else with similar issues.

  • Hello, I am resurrecting this old post because I am more or less looking for the same thing.

    Whenever a post is created the save_post filter immediately creates another revision of the post, so, consecutive posts, don’t have consecutive ids.

    However, I do need revisions, so how can I prevent revisions on the save_post function?

  • Ah, thanks John! I see this list includes some hogs like Select2…

    I have already created a support ticket to ACF devs, let’s see how that goes. If I get any results, I’ll report back!

  • Well, I realized that much, I was looking for specifics – something like a list of the styles and scripts used.

    I understand for example, that ACF itself uses the select2 plugin in the admin in several cases, but I don’t get why this is loaded through the acf_form_head function in the frontend – in an ideal workflow, the plugin would somehow manage to see which field types are used and load the necessary scripts. On top of that having additional options on ‘heavy’ components – like the Repeater – to toggle on/off features not required, eg the sortable function or remove the tooltips.

    ..since this is not the case, I am willing to try by the good’ol’ trial-and-error method to see what works and what breaks in my frontend.

    Any pointers to specific script/style handles will be appreciated!

  • ahh… I apologize for this, it’s slightly irrelevant to the repeater field after, but thought I’d post the solution anyway just in case someone else is exhausted like me and can’t figure out the solution.

    I had enabled parsley validation, and due to the way the repeater element works, it was expecting validation from the hidden acf-clone element…

  • Answering my own question… found a snippet online that resolves the issue – credit to whoever provided it!

    add_action( 'wp_print_scripts', 'pp_deregister_javascript', 99 );
    function pp_deregister_javascript() {
    		 wp_deregister_script( 'jquery-ui-datepicker' );
    		 wp_deregister_script( 'wp-color-picker-js-extra' );
    		 wp_deregister_script( 'wp-color-picker' );
  • John,
    thank you for your help, I’ve been visiting the forums often and your posts have been very helpful to me so far.

    I realize that the problem derives from the fact that each repeater subfield can only have a specific set of choices, but I wonder why – hopefully the plugin is extended to support this.. at least target something.

    The function you are describing would be great, as long as I can target what you describe as {DYNAMIC SELECT FIELD NAME}. How do you target this?

    Other than that, populating the field like this is not causing any issues with non-repeater fields, so it might not be a problem here either.

    The way I am using to populate the select field (in non-repeater fields) so it includes the necessary choices, is something like you proposed.. I use a $_GET variable with the post_id and using this I retrieve the manufacturer selection; after that I populate using the prepare_field and the json file – so, when the field is rendered, it already includes the saved model in its choices.

    For the repeater field the closest I can get to is to use the post_id and loop all selected manufacturers and create a choice-list that includes the sum of all manufacturers… which is not what I want.

    The alternative is simply to run a JS function and populate all select fields individually, but this happens client-side and is somewhat heavy.

    So essentially the question is… how can I target individually a select field at a specific repeater row using something like what you proposed – {DYNAMIC SELECT FIELD NAME}?

Viewing 14 posts - 1 through 14 (of 14 total)