Title: repeating custom fields
Last modified: August 21, 2016

---

# repeating custom fields

 *  [bluelemonade](https://wordpress.org/support/users/bluelemonade/)
 * (@bluelemonade)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/repeating-custom-fields/)
 * Hello,
 * I created a few custom fields set with one repeating field image1. I get the 
   customs fields, but the content of the repeated field shows only the first or
   last value
 *     ```
       "wpcf-image1": "http://192.168.1.185/base/wp-content/uploads/2013/03/introbild.jpg",
       "wpcf-image2": "http://192.168.1.185/base/wp-content/uploads/2013/03/DGF_0306.jpg
       ```
   
 * there is a comma behind the first value of wpcf-image1, but the seconds value
   is missing. what’s wrong?
 * [http://wordpress.org/plugins/json-api/](http://wordpress.org/plugins/json-api/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [bluelemonade](https://wordpress.org/support/users/bluelemonade/)
 * (@bluelemonade)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/repeating-custom-fields/#post-4351306)
 * ok, I put this into set_custom_fields_value() inside post.php
 *     ```
       if ( count($wp_custom_fields[$key]) > 1){
       $cnt = count($wp_custom_fields[$key]);
   
       $str = "";
       for ($pos = 0; $pos < $cnt; $pos++) {
       	$str= $str . $wp_custom_fields[$key][$pos];
        	if ($pos < $cnt-1){
        	 	$str= $str. ",";
        	}
       }
           $this->custom_fields->$key = $str;
       }else {
           $this->custom_fields->$key = $wp_custom_fields[$key][0];
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘repeating custom fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [bluelemonade](https://wordpress.org/support/users/bluelemonade/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/repeating-custom-fields/#post-4351306)
 * Status: not resolved