• Resolved motivmedia

    (@motivmedia)


    I’m in the habit of making base settings with a custom plugin. Went through my desired defaults, just check FVM’s settings in wp_options and noticed that it doesn’t store the serialized but in a custom way. Not saying this is bad, but does FVM provide methods for programmatically making settings from outside the plugin?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Raul P.

    (@alignak)

    The data is not serialized, it’s json encoded.
    You can access it as an array, inspect the keys and save it’s settings accordingly.

    
    // get settings
    $fvm_settings = json_decode(get_option('fvm_settings'), true);
    // your changes here
    $fvm_settings['some_key'] = 'value';
    // resave
    update_option('fvm_settings', json_encode($fvm_settings), false);
    

    If you are doing this, please ensure it doesn’t check on every pageview, else you will stress the database. Use transients perhaps, or some “done” field, somewhere else as a control.

    Thread Starter motivmedia

    (@motivmedia)

    Sometimes I should think before I ask. Too much autopilot today, basically asking how to handle JSON. Thank you for the quick response and thank you for your great work!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Settings not serialized’ is closed to new replies.