Skip to main content
Reliable Core

Enhancing Efficiency: Optimizing the Reliable Core Broken Link Audit Plugin

By No Comments2 min read

In the prior version, the plugin utilized sitemaps from individual websites to extract their respective posts. Subsequently, each post underwent parsing to identify broken links. This approach resulted in a substantial number of requests for a single website. Specifically, the requests were distributed as follows: one request for sitemap parsing and an additional number of requests equivalent to the posts retrieved from the sitemap. For example, if there were 300 posts, this would lead to another 300 requests.

In the updated version, the plugin leverages the WordPress REST API to obtain a website’s posts. With a single request, the REST API can retrieve a maximum of 100 posts. This optimizes the request count significantly for a single website. To illustrate, if a website possesses 300 posts, the new version would generate only 3 requests to the REST API, each requesting 100 posts.

Considering performance, the new version proves advantageous due to its direct acquisition of post content through the WordPress REST API in JSON format. This streamlined approach accelerates the process of checking an individual post for broken links. In contrast, the old version retrieved the entire post content in HTML and subsequently employed regular expressions to locate links. These extra steps in the older version lengthened the process. Moreover, the reduced number of requests in the new version further enhances its speed.

The transition from the old to the new version also involves noteworthy code reduction. During the upgrade, redundant code that had gone unnoticed was identified and eliminated, resulting in a more streamlined and efficient codebase.