Using Wordpress Get_Option on Plugin to Retrieve a Text Value and Display It

The $options variable holds my wordpress plugin options. I've seen people print_r but I'm not sure how to just echo it in a tag for instance.

$options = get_option('simpledir_options', array() );

print_r($options);

This outputs:

Array ( [custom_css_styles] => disable 
[custom_css_textarea] => a{color:hotpink;} )

How can I just get the css value of a{color:hotpink;}?

1

1 Answer

you need to load 'wp-config.php' properly to load 'get_option' function into a page. like:

  require_once '../../../wp-config.php';

Your Answer

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

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest