Forum Replies Created

  • Hey @proxxim ,

    in case you’re still wondering, I could easily just put it in a enqueued JS file that loads in the backend, and the colour picker only offers up theme colours which are defined for Gutenberg via theme.json. No need to wrap the code above, and you can easily enqueue the JS like normal (the CSS file is not needed though):

    function load_admin_stuff() {
    	wp_enqueue_style( 'admin_css', get_stylesheet_directory_uri() . '/css/admin.min.css', false, '' );
        wp_enqueue_script( 'admin', get_template_directory_uri() . '/js/admin.min.js', array(), '', true );
    add_action( 'admin_enqueue_scripts', 'load_admin_stuff' );

    Can’t help you with the terms stuff, though I would suppose ACF just reads the values from Gutenberg, but doesn’t necessarily need Gutenberg to be loaded.

  • And I just solved it myself. You need to create an array and fill it with each and every file’s ID, off you go:

    function default_photos( $field_photos ) {
        $photos = get_field('artist_photos', 'option');
    	$array = array();
    	foreach ($photos as $photo) {
    		$id = $photo['ID'];
    		array_push($array, $id);
         $field_photos['default_value'] = $array;
         return $field_photos;
    add_filter('acf/load_field/name=press_photos', 'default_photos');
  • Hey @inhouse ,

    I know I’m late to the party, but had a bit of a hard time getting my head around previews as well and found out how to cope with it.
    You can enqueue your styles and/or scripts like so:

    		// your other arguments
    		'enqueue_assets' => 'blockname_assets',

    and then have a conditional enqueue like this:

    // Enqueue scripts & styles if frontend
    function blockname_assets() {
    	// Frontend loading
    	if(!is_admin()) {
    		wp_enqueue_style('blockname', get_template_directory_uri() . '/css/blockname.min.css' );
    		wp_enqueue_script('blockname', get_template_directory_uri() . '/js/blockname.js', array(), '', true );

    and extend it, so that different enqueues are happening for backend and frontend. Does that help you already 🙂 ?

  • Hey @eaglejohn , how did you exactly proceed? I included first the part from the required.php and then the snippet from the functions.php in my own functions.php file. Files seem to upload, and appear as gallery images in the post created, though I get a warning after form submission:

    Warning: pathinfo() expects parameter 1 to be string, array given in /xxx/xxx/xxx/xxx/ on line 4375

    Anything I am doing wrong here?

  • Hey John, thanks for the link (and sorry for the delay in responding)! Is there a way via acf_get_setting to not only get the current or default language, but a language of choice?

    What I actually need and am working on is a foreach loop through all WPML languages and the retrieval of a specific field from the options for each of the languages, to be exact.

    Thank you in advance!

  • Would be interested to know as well, since I often use clones within a group, this creates unnecessary wrapping, would love to have conditional logic in either way as well.

  • +1, highly needed 😉!

  • Thank you, @qb16 , that helped a lot. Has become quite a hassle to get a simple map with a tiny marker setup with ACF to display on a website (not ACF’s fault though), thanks for helping out!

  • Given that this thread and problem is so old already (and had been reported before), did anyone come up with a solution? I have developed a very basic columns shortcode based on flexbox, and though I can hide empty paragraphs with CSS, it’s still a bit risky and not very beautiful to have trash in the code :).

    Would love to hear from someone possibly having cracked this thing :).

  • You won’t even need to come here, since the documentation has the right code now as well ;). I have a private little database of code snippets put into Evernote, and I hurried to add this little thing to it for the next time I need it.

    You could probably mark my post with the code as the solution, so others coming here find it right away ;).

    Good luck with the next 25(0) projects then ;).

  • I was kidding. Real hard, actually.
    I am just glad this has been solved, so I can pin on the next problems to solve them ;).
    Is this solution still of value to you, after such a long time?

  • It looks like it. The documentation seems to have been updated with it, too: .

    Is 16 months a long time on the interweb :)?

  • Elliot finally got it going for me through personal support. If anyone is still interested, here is the code:

    /* ACF: limit child-page selection to current page’s children */
    function childpages_query( $args, $field, $post_ID )
        $args['post_parent'] = $post_ID;
        return $args;
    add_filter('acf/fields/relationship/query/name=pages_childpages', 'childpages_query', 10, 3);

    while pages_childpages is the relationship field. It finally works in my case ;).

  • Being on ACF Pro it still doesn’t seem to work. When I add it to my functions.php, and I really took care of it being proper, I only get a spinning loading animation, but no pages are being shown which I could select. If I leave off the filter, the field then works well (but of course showing all instead of only pages of the current page). Or did I miss anything here?

    Code is standard:

    function childpages_query( $args, $field, $post )
        $args['post_parent'] = $post->ID;
        return $args;
    add_filter('acf/fields/relationship/query/name=pages_childpages', 'childpages_query', 10, 3);

    Thanks for any help in advance ;).

  • A bit late to the party, but in hunt of the same things, since I have to loop shortcodes into shortcodes in order to have my users comply with the design/structure needed. It would be easier to work with attributes generated through an ACF field group, so e.g. a URL of a post picked via ACF is turned into an attribute or an image picked turns into a specific size’s URL etc.

    Any progress of any kind from anyone? Different solutions :)?

  • I can confirm Elliot seems to have silently gotten rid of the problem, since all my problem children are now able to connect to the license server and updated accordingly.

  • F*ck, that bug (?) just cost me a whole lotta time… thanks for pointing this out, Jeff, really appreciated! Now it is saving properly, phew!

  • Dear @wwdboer ,

    you just officially saved my day – thank you so much <3!

  • Yeah, and Strato has no idea and crappy support, no way of solving this, @frances .

    @elliot still not working, sorry.

  • Hi @elliot ,

    same here. Tried to solve it with the hoster via e-mail tickets for weeks, no dice, and still not working since you changed your hosting stuff, unfortunately 🙁 .


  • Hi there,

    this seems to be connected to some kind of server settings on some hosting environments. I have just discovered that two sites hosted on Strato ( are affected by the connection issues and won’t let me install my license and update accordingly. Did anybody come up with some kind of fix? I presume it is something on the hoster’s end and we cannot do much about it, but it would be good if we could point out what the actual problem is. ACF support was kind, but has no clue, since it seems server related.

  • In my case, it actually was real easy. Another plugin responsible for drag’n drop re-ordering of posts and CPT items interfered with ACF. Once I disabled it, ACF worked flawlessly and as before. Just for those who have problems with re-ordering not being saved in the backend may just look out for some faulty plugin.

  • Hey Hube2,

    I would really like to, but the project I am working on is strictly on a limited budget on which I already toss in extra hours. This functionality is actually a personal plus, and since I have such a workload I probably won’t have the time to handle Gravity form’s specialities this time around. If I find another project where I need it again I will investigate more. Thank you so far for your effort in helping out on this matter. It worked, in the backend, flawlessly, too bad not with GF at all :/.



  • Oh well, then this might just be something on Gravity form’s end I suppose, since I had trouble filling other (non-text) ACF fields as well. Too bad, but thank you for your help anyway! There doesn’t seem to be a different hook for gravity forms submissions to alter a field before saving it..

  • Oh, I may have come across the problem itself.

    add_action('save_post', 'add_image_to_acf_field');

    is supposed to trigger when a post is published, right, not when a post is saved regardless of the saving type?

    The front-end submissions only get saved as drafts, and once I publish it afterwards (i.e. open in backend and publish it), the field gets filled properly. So the draft state might be the problem?

Viewing 25 posts - 1 through 25 (of 44 total)

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.