update a value in wordpress wp_options

I am trying to modify a plugin and in which i require to update a value in wp_options which has multiple values .

My option_name is ws_mem_options

Read More

and the

option_value has values such as in format

s:20:"pro_sp_email_subject";s:36:"Thank You! (instructions for access)";s:20:"mem_email_message";s:309:"Thanks %%first_name%%!

%%item_name%%

Transaction ID: %%txn_id%%
Charges today: $%%amount%%

Your order can be retrieved here:
%%sp_access_url%%
( link expires in %%sp_access_exp%% )

If you have any trouble, please feel free to contact us.

Best Regards,
Don't Just Watch TV, Participate!";s:120:"mem_coupon_codes";s:66:"CHRISTMAS-25|25%|01/01/2021
100%OFF|100%
SAVE-10|10%
dumpme|10%";s:15:"mem_default_tax";s:4:"0.0%";s:13:"mem_tax_rates";

how can i add more values to

s:120:"mem_coupon_codes";s:66:"wow-25|25%|01/01/2021
    100%OFF|100%
    now-10|10%
    dumpme|10%";

Related posts

2 comments

  1. What you are looking at is serialized data– possibly multiple bits of serialized data as @Rarst noted. The Options API will serialize and unserialize automatically so all you need to do is:

    $data = get_option('optionkey');
    // $data will be unserialized into whatever data type it was originally, object, array, etc
    // manipulate your data with ordinary PHP object and array techniques
    update_option('optionkey',$data);
    

    Reference

    http://codex.wordpress.org/Function_Reference/get_option
    http://codex.wordpress.org/Function_Reference/update_option

  2. If you have access to run SQL queries, you can select the option_value you want to change and update it with new option_value by running an SQL query.

Comments are closed.