I have wrote a plugin for wordpress and now I want to add more features into it. One of the feature requires options. To store the options I’m trying to use wordpress functions add_option
, update_option
and get_option
. But when I try to add new option the add_option
function always returns FALSE
. I tried get_option
. This function returns FALSE
as well. Also I checked the table wp_options
in the database. There’s no this option. Also I have tried to use update_option
and still get the same result. What I’m doing wrong?
1 comment
Comments are closed.
Try with register_setting().
With this functions u could had an option page to your plugin where the user can change some option.
If you don’t know how to use it then check my tutorial here
It’s about option for theme, but it works for plugin to 🙂
https://codex.wordpress.org/Function_Reference/register_setting
I hope that help u