I want to share data in specific wordpress database tables with an iOS app. The client wants data entry via wordpress form plugins which create their own tables in the wp database. The plugins I've looked at don't have APIs themselves and examples of wordpress REST APIs all use AJAX which I'm not familiar with and/or can only access info in wordpress posts or user data. Is there a way to do this via php that doesn't involve accessing the database directly? I fear changes in database structure with updates could break the app.


Unless you want to use PHP to run queries directly on your database, you'll have to use a REST API and Javascript to gather the data. One point worth noting is these REST API's also use direct database queries in order to gather info to return to you when you make a request. This means that any updates to Wordpress database structure that would break your app if you wrote PHP to access the DB would also break the API plugin you use. The only difference is most plugin devs are pretty quick as far as updates go when their code becomes deprecated, and may be able to fix any issues faster than you could.

Here's one JSON API plugin I found in the Wordpress repo: http://wordpress.org/plugins/json-api/

I'm sure there are others. Just look around. Let me know if this helps clarify things a bit.

  • Yeah I've decided to go with accessing the db directly. I'm not familiar with JavaScript or Ajax and I don't see a way to access anything other than than the main wordpress tables with these APIs. Changes to database structure would only require small tweaks in php files that serve the app anyways so wouldn't need to wait for apple to approve an update. – TijuanaKez Oct 3 '13 at 23:06

Your Answer

