Title: Breaks any REST API request using array items
Last modified: December 14, 2019

---

# Breaks any REST API request using array items

 *  Resolved [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/breaks-any-rest-api-request-using-array-items/)
 * Since WP 5.3.1 update we have had many reports of our API not working in some
   cases. I traced this back to Ninja Forms which when active shows PHP warnings
   in the REST API response, these unfortunately for some users are even showing
   with WP_DEBUG set to false.
 * The root cause is in your plugin file: /includes/MergeTags/Other.php line 54
   `
   $value = wp_kses_post( $value );`
 * You are not checking if the value is an array first. Any i’m not sure you even
   need to run this on the API requests?
 * To replicate:
    1. Turn on WP_DEBUG to true (not needed in some cases) 2. Have
   Ninja Forms installed and active 3. Visit a API url with a array value eg: /wp-
   json/?test[]=123
 * Result:
    <b>Warning</b>: preg_match() expects parameter 2 to be string, array
   given
 * Please fix and release this ASAP.
 * Thanks,
 * Stiofan

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Justin McElhaney](https://wordpress.org/support/users/jmcelhaney/)
 * (@jmcelhaney)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/breaks-any-rest-api-request-using-array-items/#post-12301157)
 * I have added an issue in our system for this: [https://git.saturdaydrive.io/_/ninja-forms/ninja-forms/issues/4124](https://git.saturdaydrive.io/_/ninja-forms/ninja-forms/issues/4124)
 *  Thread Starter [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/breaks-any-rest-api-request-using-array-items/#post-12439542)
 * This is a 2 month old bug that should take 30 seconds to fix, i tried to do a
   pull on our git system but the develop branch seems several versions out of date.
 * We keep adding a filter to our plugin to mitigate this for your current release,
   thinking this is such a huge bug with such a simple fix that it MUST be in the
   next release, now every time you do a release it breaks hundreds of our customer’s
   sites, PLEASE FIX THIS!!!!
 * Here is the fix, just please update it! Go, go do it now so its in the next release,
   it will take you 30 seconds at most…
    /includes/MergeTags/Other.php line 54 FROM:`
   $value = wp_kses_post( $value );` TO: `$value = is_array($value) ? wp_kses_post_deep(
   $value ) : wp_kses_post( $value );`
 *  [mookie4a4](https://wordpress.org/support/users/mookie4a4/)
 * (@mookie4a4)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/breaks-any-rest-api-request-using-array-items/#post-12476793)
 * Thank you! That code change fixed weeks of PHP warning logs for me

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Breaks any REST API request using array items’ is closed to new replies.

 * ![](https://ps.w.org/ninja-forms/assets/icon-256x256.png?rev=1649747)
 * [Ninja Forms - The Contact Form Builder That Grows With You](https://wordpress.org/plugins/ninja-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninja-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninja-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/ninja-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninja-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninja-forms/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [mookie4a4](https://wordpress.org/support/users/mookie4a4/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/breaks-any-rest-api-request-using-array-items/#post-12476793)
 * Status: resolved