Overview
The Settings endpoints provide access to manage Web Stories plugin configuration. These endpoints extend the WordPress REST API Settings Controller with theweb-stories/v1 namespace.
Base Path: /wp-json/web-stories/v1/settings
Get Settings
Retrieves all registered Web Stories settings.GET /web-stories/v1/settings
Response
Available Settings
The exact settings returned depend on what’s registered in WordPress. Common Web Stories settings include:Archive page display settingOptions:
default, disabled, customActive publisher logo attachment IDUsed as default logo for new stories
Publisher logo placeholder URL
Google Analytics tracking IDExample:
UA-XXXXXXXXX-X or G-XXXXXXXXXXWhether to enable video caching
Whether to remove all plugin data on uninstall
Update Settings
Updates one or more Web Stories settings.POST /web-stories/v1/settings
Request Body
Include any settings you want to update. You can update multiple settings in a single request:Archive page display setting
Active publisher logo attachment ID
Google Analytics tracking ID
Enable/disable video caching
Enable/disable data removal on uninstall
Response
Returns all settings (same format as GET request) with updated values.Partial Updates
You only need to include settings you want to change. Other settings remain unchanged:Settings Schema
The settings endpoint inherits WordPress’s REST API Settings schema. Each setting has:- Type: Data type (string, integer, boolean, etc.)
- Description: Human-readable description
- Default: Default value if not set
- Sanitize Callback: Function to sanitize the value
- Show in REST: Must be true for the setting to be accessible via API
Permissions
Settings endpoints require administrator-level permissions:Get Settings: Requires
manage_options capabilityUpdate Settings: Requires manage_options capabilityOnly administrators can access and modify plugin settingsCommon Errors
Status 403: You don’t have permission to manage settingsRequired capability:
manage_options (typically administrator only)Status 400: Invalid setting name or valueThe setting name doesn’t exist or the value doesn’t match the expected type/format
Publisher Logo Setting
The publisher logo is a key setting used throughout Web Stories:Story_Post_Type.php:134 where this is used as the default meta value).
Analytics Integration
The Google Analytics tracking ID setting enables analytics for your web stories:UA-XXXXXXXXX-X) and Google Analytics 4 (G-XXXXXXXXXX) formats.
Video Cache Setting
Control whether video files are cached:Data Removal Setting
Control what happens when the plugin is uninstalled:- true: All stories, templates, settings, and data will be deleted when plugin is uninstalled
- false: Stories and data are preserved after uninstall
Using Settings in Your Application
Settings are useful for configuring the story editor or display:WordPress Settings API Integration
The Settings Controller integrates with WordPress’s Settings API. Settings must be:- Registered via
register_setting() - Have
show_in_restset totrue - Have appropriate sanitization callbacks
- Be in the
web-storiesoption group (or similar)
Best Practices
- Validate Input: Always validate setting values before submission
- Check Permissions: Ensure the current user has
manage_optionscapability - Handle Errors: Check for error responses and display appropriate messages
- Update Selectively: Only include settings you’re changing in POST requests
- Cache Responses: Settings don’t change frequently, consider caching the response
Related Endpoints
Settings work in conjunction with other Web Stories endpoints:- Publisher logo setting references media from the Media endpoints
- Archive setting affects story display on the frontend
- Analytics setting integrates with story tracking