3

I have a custom setting page, where i have a radio to Enable or Disable Registration then try to update the wpoption (users_can_register). Screenshot:enter image description here

I've tried both true/false & 1/0 but it doesnt update when i saved it in my custom settings, but when i checked the checkbox in the general settings, it gets updated..

Here's the codes im trying to use on my theme's functions.php

if (get_option('user-reg-allow') == 'enable') {
    update_option('users_can_register',1);
}
elseif (get_option('user-reg-allow') == 'disable') {
    update_option('users_can_register',0);
}
4
  • Are the option names different - the first one looks like a typo?
    – Welcher
    Commented Mar 31, 2017 at 13:47
  • @Welcher oops, my bad. Yes a typo xD Commented Mar 31, 2017 at 13:52
  • Where is this code being processed? I think we might need some more context to be able to help
    – Welcher
    Commented Mar 31, 2017 at 13:57
  • I placed it on my theme's function.php also the radio enable/disable on the framework acera. Commented Mar 31, 2017 at 14:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.