utils/wp-api/settings
Functions
'Read the “', Functions, '” section'importSettingsFromWPAPI()
'Read the “', importSettingsFromWPAPI(), '” section'function importSettingsFromWPAPI(endpoint: string): Promise<void>
Defined in: studiocms/packages/studiocms_devapps/src/utils/wp-api/settings.ts:28
Imports site settings from a WordPress API endpoint and updates the local database.
Parameters
'Read the “', Parameters, '” section'string
The WordPress API endpoint to fetch settings from.
This function performs the following steps:
- Constructs the URL for the settings endpoint.
- Fetches the site settings from the constructed URL.
- Logs the fetched settings.
- Downloads the site icon if available.
- If the site icon is not available, attempts to download the site logo.
- Constructs the site configuration object.
- Updates the local database with the fetched settings.
- Logs the success or failure of the database update.
Promise
<void
>
Will log an error message if the fetch or database update fails.