Forum Replies Created

  • I was running ACF PRO 5.7.0 but as an mu-plugin so it wasn’t obvious to me there was newer versions.

    Elliot replied in a ticket to me;

    In the most recent versions of ACF and ACF PRO we have moved around the order of actions allowing the “acf/load_value” action to run last (after “acf/load_value/type=repeater”).

    If you hook into the “acf/load_value” filter, you should now be able to customize the repeater field value as an array, not as a numeric number.

    So this has changed very recently. Now with version 5.7.6 you can handle it like this;

    	function my_acf_load_method($value, $post_id, $field) {
    		if ($field['type'] == 'number') {
    			$value = 123;			
    			return $value;
    		} elseif ($field['type'] == 'repeater') {	
    			$value[] = array(
    				'field_url' => '',
    				'field_text' => 'Google'
    			return $value;
    	add_filter('acf/load_value', 'my_acf_load_method', 20, 3);

    Checking the value of your repeater, returning $value as a string where the acf/load_value method is expecting a string, and $value as an array when it’s expecting an array.

    Much easier, thanks again Howdie_McGee.

  • @howdy_mcgee – you are an absolute legend.

    Thanks a million for coming back with this, it’s a huge help. Will crack on with this and reply to add anything I can to the thread for future users.



  • Thanks for posting the solution – even returning an integer has moved me forward a bit.

    I know you are saying your code is full of red herrings relating to your plugin, could you post some of it anyway? – I can’t workout what to do based on this;

    stripped the parent name prefix off the subfields I was able to prepopulate the repeater with my custom table data

    Tantalising. Sorry to be a pain asking for the codez !


  • Not wanting to crash this thread, just to notify you that I have also had this exact problem. Nothing fancy, not part of a repeater. Just some image upload options that were used in the header and the footer.

    Worked everywhere (including CPTs) but not on archive/category pages of normal posts.

    Disabled all plugins, still the same. Tried it with Image Objects and Image urls. On the archive pages it was returning the Image ID on archive/category rather than the url. In the end rather than try to work around it I just changed image upload to url instead which works fine.

    I’m not sure this helps much but filing it anyway in case it might.


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