ap_opt( string $key = false, string $value = null )
Description #
To retrieve AnsPress option.
Parameters #
- $keystring (Optional) Name of option to retrieve or keep it blank to get all options of AnsPress. Default value: false
- $valuestring (Optional) Enter value to update existing option. Default value: null
Source #
File: includes/options.php
function ap_opt( $key = false, $value = null ) { $settings = wp_cache_get( 'anspress_opt', 'ap' ); if ( false === $settings ) { $settings = get_option( 'anspress_opt' ); if ( ! $settings ) { $settings = array(); } wp_cache_set( 'anspress_opt', $settings, 'ap' ); } $settings = $settings + ap_default_options(); if ( ! is_null( $value ) ) { $settings[ $key ] = $value; update_option( 'anspress_opt', $settings ); // Clear cache if option updated. wp_cache_delete( 'anspress_opt', 'ap' ); return; } if ( false === $key ) { return $settings; } if ( isset( $settings[ $key ] ) ) { return $settings[ $key ]; } return null; }
Expand full source code Collapse full source code View on GitHub: includes/options.php:26
Add your comment