To use the settings defined by the JSON structure in other parts of your WordPress site, you’d follow these general steps:
- Fetch the saved settings using
get_option()
, passing theoption_name
from your JSON configuration. This retrieves an array of settings. - Access individual settings by key, matching the field IDs in your JSON. For instance,
$google_settings = get_option('aif_google_settings_settings'); $api_key = $google_settings['aif_api_key'];
would retrieve the API key. - Utilize these values as needed within your WordPress theme or plugin files to tailor functionality or display content based on the user-configured options.
Always ensure to check if the setting exists before using it to avoid errors. For a comprehensive guide, consult the plugin documentation and the WordPress Codex on get_option()
.