0

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.

Thanks

1
  • 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, 2012 at 4:01

2 Answers 2

0

Try this:

$optionname = 'option_1';
update_option( 'prefix_' . $optionname, $option_value );
0

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

try to debug your application.

var_dump($variable,$data);
update_option($variable,$data);
2
  • That’s not how var_dump() works. The second argument controls the display option.
    – fuxia
    Nov 14, 2012 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... Nov 14, 2012 at 6:42

Your Answer

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

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