Linking WordPress to Salesforce

Many businesses have their content published on CMS tools like WordPress.

How many of them want to migrate and switch to Salesforce? A critical decision for sure. Right?  So, what is the solution?

Here is a good sign – Salesforce has provided a way to connect an external content management system to Salesforce based community and that too just point and clicks. Isn’t it cool?

Here is a list of supported 3rd party CMS systems:

  • Adobe Experience Manager
  • Drupal
  • SDL
  • Sitecore
  • WordPress
  • Other

We recently worked for one of our customers to link their WordPress CMS with their Salesforce community. The requirement was to connect the 2 systems and display content on community-based on user’s language to support a multilingual community.

Here are 3 easy steps:

Step 1: CORS 

Cross-Origin Resource Sharing (CORS) is used by CMS Connect to access external content.
In Quick Find Box search for CORS, click on New Button
Enter your community domain URL and add it to the list of trusted hosts in the CORS header in your CMS system.

Step 2: CMS Connection

This requires an enabled Community. Once you have a community-created, you will be able to create the connection between your WordPress site and your Community.

  1. In the Community Workspace, select Content Management.
    In content management, select CMS Connect and then click on “New” button in the upper right corner.

Connection Details

    1. Enter a Name for Connection.
    2. CMS Source as “WordPress”
    3. Connection Type as “Public”
    4. Server URL as your WordPress domain URL.

In the JSON section of connection, for an individual blog, please provide details in Content Item. However, for getting a list of blogs, provide detail in the content list.

2 essential information captured in both sections are:

    1. Name of content. This needs to be referred to in Step 2
    2. Path: Path here is a Rest API callout to WordPress site which returns response in JSON.

For more information about Rest API refer the Rest API Handbook

Path example – for content item

wp-json/wp/v2/posts/{component}

For content list – wp-json/wp/v2/posts?number={itemsPerPage}&page={pageNumber}

If you have language enabled in WordPress, you need to enable language in CMS Connection as well and then to fetch posts based on the language you need pass parameter in Rest API call path above.

Example –

wp-json/wp/v2/posts?lang=en OR wp-json/wp/v2/posts?lang=fr

Click “Save”.

Step 3: Add CMS Connect Component on Community Page

The next step is to add the CMS Connect Component in the Community page for the blog posts to display on.

  1. Go to the Community Builder.
  2. Create or Open an existing Community page, add the CMS Connect (JSON) component in the Content area.
  3. In Properties section,
    • CMS Source: select the CMS Source we created
    • JSON Content: Blog List
    • Component Path: LEAVE THIS BLANK
    • Content List Layout: Grid
    • Items Per Page: This is totally up to you, but I go with 3 as the default
    • Columns: Again, totally up to you, but I go with 3 as the default
    • Content list Item Layout: Card
    • Title @title
    • Author @author
    • Published On @date
    • Body @content/rendered
    • Featured Image @featured_image
    • Link Text: Read More
    • Type: External URL (to link it WordPress site blog URL)
    • Page: Select the page you created in Step 3
    • URL @link
  1. Save the properties and publish the community.

ta-da! You are all done.

#HappyConfig