CalderaWP / searchwp-api-route

Adds an endpoint to the WordPress REST API for searching via SearchWP
33 stars 15 forks source link

Add check for null query result #8

Open bvisness opened 7 years ago

bvisness commented 7 years ago

For some versions of SearchWP, the posts field of SWP_Query can come back null, causing warnings when used in a foreach loop. This adds a check for null that ensures an empty array is always used.

daltonrooney commented 6 years ago

Just encountered this problem myself, thanks for posting! Hope it's merged into the main repo eventually.