Introduction to Managing a WordPress blog using Power Automate – Part 1

My WordPress blog SharePains has been running on WordPress for a very long time now. With so many posts it is a real challenge to make sure that there aren’t any broken links and other issues in any of the posts.

Automating the management of a WordPress site

In the Power Platform there has been a useless WordPress connector for a very long time. Recently however a second WordPress connector was added.

With this connector I’ve been working on a tool that doesn’t just report issues to me, it also validates and fixes issues. Automatically fixing issues can be a tricky one. In my case I found a variety of reasons why I ended up with broken links. Manually fixing these has still my preference in some cases but in other cases I might as well get Power Automate to fix the links for me.

I created a number of flows in my solution that checks my WordPress site.

Introduction to Managing a WordPress blog using Power Automate - Part 1
Introduction to Managing a WordPress blog using Power Automate - Part 1 1

In this post about the WordPress Connector (WP Connectr) I will focus on the collection of my post data through the connector.

Installing the Power Automate plugin

First of all I had to install a Power Automate Plugin. This plugin will enable Power Automate to connect to my site without the need to affect the visitor stats. Once you have installed the plugin you should see the Power Automate link appear in you WordPress Admin centre.

Introduction to Managing a WordPress blog using Power Automate - Part 1
Introduction to Managing a WordPress blog using Power Automate - Part 1 2

Dataverse

In my case I created Dataverse tables that will hold a copy of my WordPress site. Now you could of course read the WordPress databases and update them directly, however I’m going for the approach of copying the data into Dataverse tables so that I can also have a Model Driven App showing me the content within my site.

Managing posts in a Model driven app is a lot faster than through WordPress itself.

Building the flow to manage a WordPress blog

The connector allows us to read our posts in batches of 100. These batches are called pages in the connector as the connector is paging. The term pages however can be confusing as pages can also be created in WordPress similar to posts.

To allow us to read more than 100 posts, I’ve created an array with a sequence 1 – 11. An Apply to each is processing this array.

Manage My WordPress blog with Power Automate
Manage My WordPress blog with Power Automate

Each iteration of the apply to each will now read 100 posts before they are processed.

Introduction to Managing a WordPress blog using Power Automate - Part 1
Introduction to Managing a WordPress blog using Power Automate - Part 1 3

This is all easy. However the selction of posts is done through the Resource type. This may look like a dropdown of options, but it is not. You will have to add custom values.

Introduction to Managing a WordPress blog using Power Automate - Part 1
Introduction to Managing a WordPress blog using Power Automate - Part 1 4

Also in the new UI you have to type the Posts option.

Introduction to Managing a WordPress blog using Power Automate - Part 1
Introduction to Managing a WordPress blog using Power Automate - Part 1 5

How would we get all those other resource types?

Well there are quite a few options available:

  • Posts
  • Pages
  • Post Types
  • Post Statuses
  • Taxonomies
  • Users
  • Attachments
  • Categories
  • Comments

Reading most of your data from WordPress becomes very easy now that we can read data using this connector.

Updating my Dataverse tables with copies of my data is now easy. Read the records from Dataverse and then either create the records in my Posts table or update the existing records. In my case I will go through the content of the posts as part of my site validation flow where I can then correct any links or missing alt texts on images.

Introduction to Managing a WordPress blog using Power Automate - Part 1
Introduction to Managing a WordPress blog using Power Automate - Part 1 6

I will look at the updating process in part 2 of this series.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.