Way To Store Global Meta Values

When using posts there is a way to store meta values on a per post level. Is there a way to store values on a global site value? I want to save a numeric value that isnt tied to any single post.

I was thinking i could just do something like

get_post_meta( 0, 'somevalue', true );

This will work, but it will still be storing the value as a post field. is there anything specific that was designed for this

Solutions Collecting From Web of "Way To Store Global Meta Values"

Yes there is Option API to store site global data.

You can store some global values using add_option() then can retrive values as get_option()


add_option( 'option_name', 'option_value', 'deprecated', 'yes' );
update_option('option_name', 'option_value', 'yes');

//Get the value
$your_data = get_option('option_name', 'option_default_value');
echo $your_data;