最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Realtime database update from 3rd party apps (notion, airtable, sheet, etc)

programmeradmin0浏览0评论

Can I achieve Realtime database update from spreadsheet?

My requirements:

I have many posts with custom fields that have certain values. I have all these values stored on a spreadsheet (GoogleSheets, Airtable, Notion - you name it!). lets say a value is changed on the spreadsheet and this value was used in 20 different posts. Is there a way that I can automate this task and update it in realtime somehow without having to manually edit every post? is this possible in WordPress?

Example

product A has custom field with value of Red. This was used on 20 different posts. The value came from a sheet and now it is changed to Blue.

Now I want to update Product A and wherever the value was used to be Red will be changed to Blue automatically since it is linked with my Spreadsheet.


I would really like to hear your suggestions.

Can I achieve Realtime database update from spreadsheet?

My requirements:

I have many posts with custom fields that have certain values. I have all these values stored on a spreadsheet (GoogleSheets, Airtable, Notion - you name it!). lets say a value is changed on the spreadsheet and this value was used in 20 different posts. Is there a way that I can automate this task and update it in realtime somehow without having to manually edit every post? is this possible in WordPress?

Example

product A has custom field with value of Red. This was used on 20 different posts. The value came from a sheet and now it is changed to Blue.

Now I want to update Product A and wherever the value was used to be Red will be changed to Blue automatically since it is linked with my Spreadsheet.


I would really like to hear your suggestions.

Share Improve this question asked Jan 7, 2021 at 2:22 RezaReza 31 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

This can be done, however a couple of quick details...

  1. you'll want the 3rd party application to be the one triggering the change, otherwise it can't be real time. If you make WordPress go and get the values from the 3rd Party application it'll be scheduled and thus not 'real-time'. Do all of these apps have that ability?

  2. Rather than change the value 20 times, you'd want to store this value in the database, so when a change is triggered at the source you'd contact WP and change the value in the DB & that value would then appear in all the posts.

  3. You'll want to build this as a plugin and instead of using custom fields it'd be better if you generated a custom post meta box where you could assign the plugin field to get the value from. You could still use custom fields, but then, when a custom field is present, rather than show it's value, you'd instead go to the plugin's options data and get the most up-to-date value for that field.

By 'generating a custom meta box for posts' what I mean is that you'd create a setting on a post that says "Use this Reza Plugin Field". Then you'd select one of your predefined fields from a dropdown or checkbox list or you could use a Select2 input... would depend on use case. So now you're assigning one of your predefined fields to your post. The value of those fields is being maintained by the plugin's settings which you've written to the database and that you're updating from your third party app.

You'll want to do all of this using the REST API and a good starting point is here:

https://code.tutsplus/tutorials/wp-rest-api-creating-updating-and-deleting-data--cms-24883

And also here: https://developer.wordpress/rest-api/

发布评论

评论列表(0)

  1. 暂无评论