0

I've created a function but i have some problems with it...

 echo get_option( 'my_function', 'custom_logo' );

I try to use this in my code but it returns me an array not a string.

When i use echo $options['custom_logo']; on my plugin backend admin page the code returns the value as a string.

So how can i call it from my theme for example?

  • You saved a function to the options table under the key my_function? – s_ha_dum Jun 2 '13 at 16:53
  • yes i did that. – m3tsys Jun 2 '13 at 17:19
1

Out of context, it is hard to say anything definitive. There is a lot of information missing.

If you saved an Array to the $wpdb->options table (add_option or update_option) then get_option will return an Array. If you saved a string, it will return a string. If you want a string then you are saving the option incorrectly, but you haven't posted the code that saves this value.

As far as $options['custom_logo'] being correct, without knowing how the $options array was created I don't know what to say.

| improve this answer | |
  • the problem was i didn't declared $options like $options = get_option('my_plugin'); $custom_url = $options['custom_logo']; that resolved the problem. – m3tsys Jun 3 '13 at 16:06

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.