1. Home
  2. Docs
  3. Introduction
  4. Use settings in your plug...
  5. How to use this settings else where in wordpress site

How to use this settings else where in wordpress site


To use the settings defined by the JSON structure in other parts of your WordPress site, you’d follow these general steps:

  1. Fetch the saved settings using get_option(), passing the option_name from your JSON configuration. This retrieves an array of settings.
  2. 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.
  3. 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().

How can we help?