Search code examples
phpwordpresswordpress-themingcustom-wordpress-pageswordpress-rest-api

How Can i import plugin option wordpress?


hey guys i'm trying to import my plugin option into wordpress with php but i can't find any tutorial or describe about this section

i have this example:

my option name:

get_option('meow');

what i have in this option are

'cats'=> '2',
'food' => array('tona','fish'),

so how can i use

update_option

to import this values? i tried this way but it's not working

update_option('meow', 'cats','5');

Solution

  • You can try get_option('meow', 'cats','5'); to check or import data. update_option just updates the value of an option that was already added.

    To tell you more we need more information how you stored the option in an array. I didnt even use it in this way before.

    You can read more about it in the documentation.