How to access data in wordpress database externally using php

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.

Related posts

1 comment

  1. 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.

Comments are closed.