admin管理员组文章数量:1312782
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 badges1 Answer
Reset to default 0This can be done, however a couple of quick details...
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?
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.
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/
本文标签:
版权声明:本文标题:Realtime database update from 3rd party apps (notion, airtable, sheet, etc) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741855951a2401343.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论