Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure if you're still interested in a solution, but I was able to modify the json-api plugin models/post.php file to display the repeater data as an array. This is a modification of a modification made by <a href="http://wordpress-problem.com/marioario-on-plugin-json-api-fixed-get-all-custom-fields-the-right-way/" rel="nofollow">http://wordpress-problem.com/marioario-on-plugin-json-api-fixed-get-all-custom-fields-the-right-way/</a></p> <p>replace the set_custom_fields_value() function with the following:</p> <pre><code>function set_custom_fields_value() { global $json_api; if ($json_api-&gt;include_value('custom_fields') &amp;&amp; $json_api-&gt;query-&gt;custom_fields) { // Query string params for this query var $params = trim($json_api-&gt;query-&gt;custom_fields); // Get all custom fields if true|all|* is passed if ($params === "*" || $params === "true" || $params === "all") { $wp_custom_fields = get_post_custom($this-&gt;id); $this-&gt;custom_fields = new stdClass(); // Loop through our custom fields and place on property foreach($wp_custom_fields as $key =&gt; $val) { if (get_field($key)) { $this-&gt;custom_fields-&gt;$key = get_field($key); } else if ($val) { // Some fields are stored as serialized arrays. // This method does not support multidimensionals... // but didn't see anything wrong with this approach $current_custom_field = @unserialize($wp_custom_fields[$key][0]); if (is_array($current_custom_field)) { // Loop through the unserialized array foreach($current_custom_field as $sub_key =&gt; $sub_val) { // Lets append these for correct JSON output $this-&gt;custom_fields-&gt;$key-&gt;$sub_key = $sub_val; } } else { // Break this value of this custom field out of its array // and place it on the stack like usual $this-&gt;custom_fields-&gt;$key = $wp_custom_fields[$key][0]; } } } } else { // Well this is the old way but with the unserialized array fix $params = explode(',', $params); $wp_custom_fields = get_post_custom($this-&gt;id); $this-&gt;custom_fields = new stdClass(); foreach ($params as $key) { if (isset($wp_custom_fields[$key]) &amp;&amp; $wp_custom_fields[$key][0] ) { $current_custom_field = @unserialize($wp_custom_fields[$key][0]); if (is_array($current_custom_field)) { foreach($current_custom_field as $sub_key =&gt; $sub_val) { $this-&gt;custom_fields-&gt;$key-&gt;$sub_key = $sub_val; } } else { $this-&gt;custom_fields-&gt;$key = $wp_custom_fields[$key][0]; } } } } } else { unset($this-&gt;custom_fields); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload