How can I add and update custom settings for a plugin #48800
Replies: 3 comments 6 replies
-
|
For the data side of things you'd be using the WordPress REST API. I'd recommend having a look through this tutorial - https://developer.wordpress.org/block-editor/how-to-guides/data-basics/ It should explain how to use the data module to interact with the REST API. |
Beta Was this translation helpful? Give feedback.
-
|
Reading some blogpost about this topic:
seems that the path required is to create a custom redux store and attach it to the redux global instance. Does anyone knows if exists an alternative method ? If someone has resources/examples about creating a redux store with wp-data with error handling and all other production ready requirements and is happy to share them it will be really appreciated. |
Beta Was this translation helpful? Give feedback.
-
|
Your question is a very good one, i've spend hours in the wordpress maze of information and that information is no where to be found. How to retrieve a wp_option that was saved from a plugin and get the information in the edit.js, because in php it's just get_option('my_plugin_option'). This setting will affect the component colors, images, etc to be shown in the editor |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Which is the canonical way to add a "setting" for a plugin i made , and read/write this setting from a custom Block Editor sidebar ??
I've created a plugin that add some panel in the block editor for every block, and i want to control the presence of these panels from a global setting exposed in the Block Editor UI.
The setting is custom to my plugin, so i need to create it and be able to read and write from the database.
Research pointed me to creating a plugin sidebar in the block editor with
wp.hooks.registerPlugin, and so i created the static frontend in React.Now i need to first register, then read and write from db the "setting".
How can i do that?
Is there an equivalent to
get_option/update_optionfor JS side ?Beta Was this translation helpful? Give feedback.
All reactions