最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

plugins - How to access data in wordpress database externally using php

matteradmin8PV0评论

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.

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.

Share Improve this question asked Sep 25, 2013 at 0:41 TijuanaKezTijuanaKez 1131 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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/plugins/json-api/

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

Post a comment

comment list (0)

  1. No comments so far