Using WordPress ‘get_alloptions_110()’ PHP function

The get_alloptions_110 WordPress PHP function retrieves all options as they were in WordPress version 1.2.

Usage

To use the get_alloptions_110 function, simply call it like this:

$options = get_alloptions_110();

Parameters

  • None

More information

See WordPress Developer Resources: get_alloptions_110

Examples

Display all options

Retrieve and display all the options from WordPress 1.2.

$options = get_alloptions_110();
foreach ($options as $option_name => $option_value) {
    echo "Option Name: " . $option_name . ", Option Value: " . $option_value . "<br>";
}

Retrieve specific option

Retrieve and display the value of a specific option called “example_option”.

$options = get_alloptions_110();
$example_option_value = $options['example_option'];
echo "Example option value: " . $example_option_value;

Check if an option exists

Check if an option called “example_option” exists and display a message accordingly.

$options = get_alloptions_110();
if (isset($options['example_option'])) {
    echo "Example option exists!";
} else {
    echo "Example option does not exist.";
}

Count the number of options

Count the total number of options and display the result.

$options = get_alloptions_110();
$total_options = count($options);
echo "Total number of options: " . $total_options;

Store all option names in an array

Retrieve all option names and store them in an array.

$options = get_alloptions_110();
$option_names = array_keys($options);
print_r($option_names);