Forum Replies Created

  • Hi @supportjgp

    Conditionally defer loading depending on wether a repeater is collapsed or not is not possible. At least not in any way I can figure out. Sorry πŸ™‚

    When we’ve had projects where we needed lots of maps/markers we built the architecture around that. So we created a custom post type which would each hold a single map (called Maps for example). Then in the relevant places we could just use a post field with multiple values or a relationship field to pull in all maps we wanted without performance issues πŸ™‚

  • Hi @richtelford,

    Term meta is planned for version 5.5.
    Currently Elliot is putting the finishing touches to 5.4 so right after that he’ll get started on development πŸ™‚

    I hope that satisfies your question!

  • Hi @richtelford

    I’ll check back with Elliot about the status of this and report back to you πŸ™‚

  • I should perhaps note that the significant difference is that I’m not running a function for the extra js parameter but rather just assign it the value of the hidden input that goes along with the select2 dropdown (not the value of the empty select element).

  • Thanks this helped me get to my own solution πŸ™‚

    For anyone in need this is how I solved a scenario where the user first selects a post object (post object field) and then selects a term from a taxonomy field which should only show terms connected to the previously chosen post.

    This works on 5.3.n and the JS is a bit different now so I think you might need to change the JS even for the solution above.


     * Filters the idrott taxonomy dropdown by selected club.
     * @since	1.0.0
    public function filter_idrott_dropdown_admin( $args, $field, $post_id ){
        $club = isset($_REQUEST['club_sport']) ? (int) $_REQUEST['club_sport'] : false;
        if ( !$club ){
    	    return $args;
    	$sports = get_the_terms( $club, 'idrotter' );
    	$sport_ids = array();
    	if( $sports ){
    		foreach( $sports as $sport ){
    			$sport_ids[] = $sport->term_id;
    	if( !empty( $sport_ids ) ){
    		$args['include'] = $sport_ids;
        return $args;


     * Update the ajax arguments for select2 objects to include the chosen club id
     * This is done by replacing the default function with a wrapper, which calls the old function and then appends "club_sport" to the results.
        function( args ) {
            if ( typeof == 'function' ) {
                var old_data_func =; // We'll keep this for maximum compatibility, and extend it.
       = function(term, page) {
                    var default_response = old_data_func( term, page ); // Call the old, default function.
                    default_response.club_sport = $('#acf-field_577e458143db1-input').val();
                    // Return the default args with our club_sport value.
                    return default_response;
            return args;
  • Hi @krzysiek-drozdz

    Yes as of 22 June 2016 all google maps API require a key.
    When this topic was posted it was not necessary however.

    I’ll ask Elliot about this and see what his solution is. It’ll probably become a settings field in ACF to supply your API key for using the maps fields.

  • Hi @jaro

    You’re probably fairly safe with this setup.

    A few things I’d consider:

    1. Make sure that ALL input data from the student is valid and escaped. Do not only rely on ACF for this but rather run it through your own checks too. For example if the code they should supply is numbers only make sure that the input value is a float (or int), strip all values of tags etc. etc.

    2. Remember that emails can be compromised so it is probably also a good idea to set a time restriction for the verification code. For instance you could make the code invalid after 1h. That way you are sure it does not matter if a students email gets hacked later on etc.

    3. Consider using shortlived WordPress transients for storing the data instead of PHP session? Or be sure to check up on your session security:

    Beyond that I think your biggest possible flaws would be human error like not updating plugins, having unsecure passwords etc.

  • Hi @pecnet

    I’m not sure what you’re asking..
    Do you want to know how to add your stores open times in admin AND how to displays todays open hours on your front end or just how to display todays open hours on front end?

  • Hi @sangnguyen

    Sure but you’ll have to perform all the functionality yourself.
    You can add your own button (or hook into the existing button).

    Then in javascript you prevent the default behavior, collect the values, trigger your own update function and voila.

  • No problem! Glad to help out.

    You have yourself a great weekend.

  • Great to hear!
    Best of luck with your form building!

  • No problem, glad you worked it out!
    Again sorry for taking so long to respond πŸ™‚

    Best of luck in your project!

  • @nadgemanforum

    Lol.. I copied your code and forgot to delete it πŸ˜‰

    Anyway, you’re welcome! If you have more questions regarding ACF feel free to write in the forums.

  • Hi @jamesryder

    I’m not sure but I think your issue _might_ be due to where you’ve placed acf_form_head.

    It should be located before any output and currently you’re placing it smack in the form.

    Try this:

     * Output ACF form functionality on the edit account page in woocommerce
    function add_acf_head_to_wc(){
    	if( is_wc_endpoint_url() ){
    add_action( 'template_redirect', 'add_acf_head_to_wc', 1000 );
     * Output our ACF image field in the WooCommerce edit account form
    function woocommerce_edit_account() {
    		'field_groups' => array(931), 'form' => false
    add_action( 'woocommerce_edit_account_form', 'woocommerce_edit_account', 10 );
     * Do an ACF save action on the user. 
     * NOTE: I'm not sure this is even needed..? 
    function my_woocommerce_save_account_details( $user_id ) {
    	// $post_id to save against
    	$post_id = 'user_' . $user_id;
    	// update the post
    	do_action('acf/save_post', $post_id);  
    add_action( 'woocommerce_save_account_details', 'my_woocommerce_save_account_details' );
  • Hi @energystar

    I would suggest that you change your field from a repeater with a post object field to a relationship field instead.

    That way you’ll get a single meta value containing a serialized array of post IDs and you can do the query you want using this:

    global $post; // This will be your post_type1 post object.
    $args = array(
    	'post_type' => 'post_type2',
    	'posts_per_page' => 10000, // Should never be set to -1 as it's a risk not setting boundaries. Good code practise!
    	'no_found_rows' => true, //Disables the use of pagination BUT saves us an additional query. Remove if you need pagination
    	'update_post_term_cache' => false, //Does not update a potentially old cache of the queried posts term relationships BUT saves us an additional query. Remove if you're going to display term info
    	'meta_query' => array( //Query the serialized array. Putting the value in quotes makes sure we dont get a hit on 1234 when we search for 123. 
    			'key' => 'relationship_fieldname',
    			'value' => '"' . $post->ID . '"',
    			'compare' => 'LIKE'

    Doing the same thing with repeaters are a lot more complex and more expensive performance-wise.

  • Hi @leuchterits

    If you set Current user role to administrator and User role to All you’ll get it the way you want it.

    That’s basically saying “Add this field to all user roles but show it only to administrators”.

  • Hi @henricakesson

    Thank you I’m sure Elliot appreciate that! I love the plugin too πŸ˜‰

    I think this is a bug in ACF and I’m pretty sure it’ve worked before.
    I will notify Elliot of this on github and link back here so he can reply if he needs more info.

    As you say ACF should be compatible with WPML but then again they’re both fairly complex so I guess things break with updates to either. I got my own headaches with WPML and my plugins so I know the feeling..

  • Hi @fonty87

    Please use the code tags when you paste code. Elliot has not fixed this issue yet but if you post weirdly formatted code without the code tags you’ll break the site layout making it impossible to answer you πŸ™‚

    I’ve fixed your post now after tinkering a bit with the CSS to be able to hit the edit button πŸ˜‰

    If you’re using the User field in ACF to store the author you need to query it by the user ID, not the display name.

    I think this change should do it (if that’s how you set it up)

    $args = array(
    	'post_type' => 'event', // required
    	'suppress_filters' => false, // required
    	'posts_per_page' => 10000, // Should never be set to -1 as it's a risk not setting boundaries. Good code practise!
    	'meta_query' => array( // Use meta query instead
    			'key' => 'vortrag_von',
    			'value' => $author->ID,
    			'compare' => '='
  • Hi @guit4eva

    If the field didn’t exist beforehand in the DB (created in some other way than this) you need to use the field key rather than the field name as the first parameter for update_field().

    As a sidenote you do not need to concatenate the strings with empty ” at the end πŸ™‚


    $displayed_user = 'user_' . bp_displayed_user_id(); // Get User ID
    $assessments_repeater = get_field( 'assessments', $displayed_user ); // Get Assessments Repeater field
    $ass_latest = end($assessments_repeater); // Get last row of repeater
    $current_level = get_field( 'current_level', $displayed_user ); //Get current level
    $ass_latest_rating = $ass_latest['ass_rating']; // Get latest rating
    $ass_at = $ass_latest['assessed_at']; // Get latest level assessed at
    if( $ass_latest_rating != 1 ) {
      update_field( 'fieldkey goes here', $ass_at, $displayed_user );
  • Hi @nadgemanforum

    It’s just a matter of looping through the values (it’s an array) and output an li for each!

    This should do it:

    if( have_rows('flexible_content_field_name') ):
       while ( have_rows('flexible_content_field_name') ) : the_row();
    		if( get_row_layout() == 'likes' ):
    			$likes_list = get_sub_field('likes_list');
    			if( $likes_list ):
    				echo '<ul>';
    				foreach( $likes_list as $like ):
    					echo '<li>' . $like . '</li>';
    				echo '</ul>';
    			echo implode(', ', $likes_list);

    Best of luck in your project!

  • Hi @watermelonkid

    Just like @jonahcoyote suggested you need to change your syntax for the ID to widget_<id>. Do that and it should work!

  • Hi @hdcms

    I’m not completely following your issue.
    The URL field type in ACF is available for both regular and PRO version.

    If you store a meta value on a post using FormidablePro that you want to access using ACF you’re going to run into a problem. Basically ACF uses two key > value pairs in the database for each meta value. One is the field name => field value and the other is the field key => field name.

    If you save the values using FormidablePro the pair field key => field name isn’t created. Then you have to manually save/update the post again for that to be created and THEN you can access it using the_field() for example.

    So you either have to use some sort of filter/action hook in FormidablePro to yourself use update_field() and save the meta value with the Field key. Or you have to wait for FormidablePro to support ACF.. πŸ™‚

    Here’s some related info:

  • Hi @chrisarter

    There’s no info on how your $cleanData looks like in your snippet but my guess is that you’re using the field names as key?

    Thing is that if you’re doing update_field for not previously existing values you have to use the field key rather than the field name. Otherwise the matching table value _fieldname with the field key as value aren’t created and because of that you’re going to have trouble using functions like get_field_object().

    The reason it’ll work after you manually hit update is because then ACF itself saves the values for the post with the field key present (so now you’ll have both values in your database).

    Just use the field keys instead and you’ll be good to go! These are hidden by default but can be turned on from the screen options in the top right corner.

  • Hi @sireagroup

    Sorry I’ve not been able to work the forum for a while πŸ™‚
    Do you still require assistance with this?

    To answer your question, I am able to see your notes, altho it seems you’ve edited out the details now?

  • Hi @claw

    Sorry to hear that but I’m glad you figured it out πŸ™‚
    I suppose if that was the only reason you needed ACF I can understand you, I often write my own plugins when I find others not doing it the way I want to. ACF is so much more than front end forms tho!

    I want to note that the ACF forum is not a guaranteed place for response. We are just 2-3 fellas working hourly here in our spare time for a low penny (it’s more about giving some back to the community). If you’ve purchased an ACF Pro license you can also try contacting the support by email. There’s a button in the right sidebar under “Support”.

Viewing 25 posts - 51 through 75 (of 1,021 total)