Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

edd_get_option

Options specific to Easy Digital Downloads are stored in an array in a single WordPress option. For this reason it’s best to use
edd_get_option() to get those options. edd_get_option() safely finds the desired option and returns it.  Additionally, it applies a filter to the output.

Input

edd_get_option() takes two input variables. The first is the key name of the option desired.  The second is a default value if the key is not found in the option array. The second value defaults to false.

Usage

Here’s an example, looking for the position of the currency indicator.  If it’s not found, $position will get a value of ‘before’.

$position = edd_get_option( 'currency_position', 'before' );

Output

The output of this function will be whatever was stored in the option, OR the default. The return function applies a filter that looks like this:

return apply_filters( 'edd_get_option_' . $key, $value, $key, $default );

Using the example from the Usage section then the filter would be named
edd_get_option_currency_position.

Read our latest blog post:
Add More Stripe Payment Methods at Checkout