Skip to content

Update WordPress Settings

Use this endpoint to update WordPress integration settings. You can:

  • Send a single site object in settings to update fields, or
  • Send an array of site objects in settings to replace the entire list of WordPress sites.
PATCH /api/v1/public/integrations/wordpress/update-settings

Include your API key in the Authorization header:

Terminal window
Authorization: Bearer YOUR_API_KEY
// Example A: Update a single WordPress site's settings
const settingsToUpdate = {
isIntegrated: true,
autoPublish: false,
credentials: {
websiteUrl: "https://myblog.example.com",
username: "wp_api_user",
password: "wp_api_application_password",
// The Application Password is not your main WordPress admin password.
// It acts as an API key specifically for publishing content.
// We store it securely using industry-standard encryption to protect your account.
},
};
fetch(
// Endpoint: {API_ENDPOINTS.INTEGRATIONS.WORDPRESS.UPDATE_SETTINGS}
"https://api.blogz.ai/api/v1/public/integrations/wordpress/update-settings",
{
method: "PATCH", // Use PATCH for partial updates
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ settings: settingsToUpdate }), // Send only the settings to update
}
)
.then((res) => res.json())
.then((data) => console.log("WordPress settings updated:", data))
.catch((error) => console.error("Error updating WordPress settings:", error));
// Example B: Replace ALL WordPress sites with an array (multi-site)
const allSites = [
{
id: "site-1",
label: "My Main Site",
isIntegrated: true,
autoPublish: true,
isWebsiteValid: true,
credentials: {
websiteUrl: "https://site-one.example.com",
username: "wp_user_1",
password: "wp_app_password_1",
},
},
{
id: "site-2",
label: "Blog #2",
isIntegrated: false,
autoPublish: false,
isWebsiteValid: false,
credentials: {
websiteUrl: "https://site-two.example.com",
username: "wp_user_2",
password: "wp_app_password_2",
},
},
];
fetch(
// Endpoint: {API_ENDPOINTS.INTEGRATIONS.WORDPRESS.UPDATE_SETTINGS}
"https://api.blogz.ai/api/v1/public/integrations/wordpress/update-settings",
{
method: "PATCH",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ settings: allSites }), // Replaces entire list
}
)
.then((res) => res.json())
.then((data) => console.log("All WordPress sites replaced:", data))
.catch((error) => console.error("Error replacing WordPress sites:", error));