Title may not be clear but I'm using update_option($my_option, $new_order); and for some reason it would not work but if instead I change to update_option('my-option-name' $new_order); it works.

I check that $my_option has a value and 'my-option-name' exists and has some values on it.

Without digging more, is there any reason or cases where using a $variable may stop the update_option(), If so, how can be sorted.


  • We need more code give an answer. The only reason is that $variable is either not set or has a wrong value. – fuxia Nov 14 '12 at 4:01

Try this:

$optionname = 'option_1';
update_option( 'prefix_' . $optionname, $option_value );
| improve this answer | |

it's posible only if your variable not exists at the moment of function update_option executes...

try to debug your application.

| improve this answer | |
  • That’s not how var_dump() works. The second argument controls the display option. – fuxia Nov 14 '12 at 6:41
  • your right Toscho, too much console.log from yesterday... but anyway debuging update code is only way to ensure that we have a problem... – Oleg Butuzov Nov 14 '12 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.