• 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/

Viewing 1 replies (of 1 total)
  • Thread Starter bluelemonade

    (@bluelemonade)

    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.