Can you change settings programmatically?

Hi,
I was wondering if there is a way to change settings through PHP code? Maybe there is a some kind of function? The settings I want to change are in the “download options” part of the admin section.
Or would I have to change the wp_option entry ws_plugin__s2member_options myself?

Best regards
Peter

Hi Peter.

If you’re asking for an s2Member API to change the s2 settings, there isn’t one.

It’s not different than other WordPress settings, so you’d use WP’s functions to handle that. https://codex.wordpress.org/Function_Reference/

https://developer.wordpress.org/reference/functions/get_option/

https://codex.wordpress.org/Function_Reference/update_option

I hope that helps. :slight_smile:

Hi Cristián

Yes, an API was what I’d hoped for. I have had some issues updating JSON objects in WordPress Options before (URLs that need to be re-encoded even though you haven’t changed its value). So I just wanted to make sure before using the update_option … option.

Thanks for your help
Peter

Ah, yes, I understand. :slight_smile: