WordPress Health Status and the new Report Parser Tool
Tags: tooling, wordpress, support, php
Published: 2023-02-02 10:00:00

<!-- wp:paragraph -->
<p>What is your WordPress version? And PHP? How many posts do you have?  Status reports gather all those information in a single place. Just copy and paste, and answer all the support questions at once. But what do we do when the report is not easy to read?</p>
<!-- /wp:paragraph -->

<!-- wp:uagb/table-of-contents {"block_id":"6bd8d087","classMigrate":true,"headingTitle":"Table of Contents","leftPadding":30,"rightPadding":30,"topPadding":30,"bottomPadding":30,"overallBorderTopWidth":1,"overallBorderLeftWidth":1,"overallBorderRightWidth":1,"overallBorderBottomWidth":1,"overallBorderTopLeftRadius":6,"overallBorderTopRightRadius":6,"overallBorderBottomLeftRadius":6,"overallBorderBottomRightRadius":6,"overallBorderStyle":"solid"} /-->

<!-- wp:heading -->
<h2 class="wp-block-heading">Asking the same questions over and over again</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Asking or answering the same questions is too boring, everybody agrees. Everybody also agrees that <strong>the solution for repeated tasks is automation</strong>. If the system knows all the answers, why not get them directly from the source, saving everybody's time? Status or system reports are meant for this.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
<p>If the system knows all the answers, why not get them directly from the source, saving everybody's time?</p>
<!-- /wp:paragraph --></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Status report pages are already common in the WordPress ecosystem. <strong>Go to a specific page, click on a button, and paste it into a ticket</strong>. The report isn't always that legible but I've created a tool to help with that.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">The <em><a href="https://felipeelia.dev/report-parser/">Report Parser</a></em> Tool</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Status pages are divided into sections containing lists of key-value pairs. In WordPress, for example, we have the "WordPress" section, and some keys are "Version", "Site Language", etc. The copy-and-paste report shared with support follows the same format but <strong>it gets really hard to read when the value is too big</strong>. Imagine a JSON object, for example.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The <em><a href="https://felipeelia.dev/report-parser/">Report Parser</a></em> helps with that problem: just paste the report into the textarea and it is possible to see it formatted with collapsible sections.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2778,"width":456,"height":512,"sizeSlug":"large","linkDestination":"custom"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><a href="https://felipeelia.dev/report-parser/"><img src="https://felipeelia.com.br/wp-content/uploads/2023/01/report-parser-screenshot-911x1024.png" alt="" class="wp-image-2778" width="456" height="512"/></a><figcaption class="wp-element-caption">Screenshot of the <em>Report Parser</em> Tool</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>The idea to create the tool came after we added the new <em>Status Report</em> page to <a href="https://github.com/10up/ElasticPress/releases/tag/4.4.0" target="_blank" rel="noreferrer noopener">ElasticPress 4.4.0</a>. There we aggregate answers for lots of common support questions, like the last failed Elasticsearch queries.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>With these Elasticsearch queries, I noticed <strong>a problem: common lists are easy to read but bigger JSON objects are not</strong>. The tool serves as a way back: keep both the easiness of copy-and-paste reports and readability for support teams.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">WordPress Site Health Info</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>WordPress 5.2 added a new page with Site Health Info, previously only available via the <a href="https://wordpress.org/plugins/health-check/" target="_blank" rel="noreferrer noopener">Health Check plugin</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2795,"width":628,"height":503,"sizeSlug":"full","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-full is-resized"><a href="https://felipeelia.com.br/wp-content/uploads/2023/01/wordpress-site-health-info.png"><img src="https://felipeelia.com.br/wp-content/uploads/2023/01/wordpress-site-health-info.png" alt="" class="wp-image-2795" width="628" height="503"/></a><figcaption class="wp-element-caption">Screenshot of WordPress' Site Health Info</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">The Report Format</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>After you click on the <em>Copy site info to clipboard</em> button, a report like the one below will be available to be pasted:</p>
<!-- /wp:paragraph -->

<!-- wp:code {"className":"yaml"} -->
<pre class="wp-block-code yaml"><code>### wp-core ###

version: 6.1.1
site_language: pt_BR
user_language: pt_BR
....

### wp-dropins (2) ###

advanced-cache.php: true
object-cache.php: true</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>As you must have noticed, the basic structure is:</p>
<!-- /wp:paragraph -->

<!-- wp:code {"className":"yaml"} -->
<pre class="wp-block-code yaml"><code>### &lt;section_name&gt; ###

key_1: &lt;value_1&gt;
key_2: &lt;value_2&gt;</code></pre>
<!-- /wp:code -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
<p><em>Report Parser</em> gets that format and transforms it back into collapsible sections and formatted tables.</p>
<!-- /wp:paragraph --></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">How to add your own sections to the <em>WordPress Site Health Info</em> page</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Well, as we are already here, let's see <strong>how simple it is to add a new section with your plugin or theme info</strong>. All we need is to use the <code><a href="https://developer.wordpress.org/reference/hooks/debug_information/" target="_blank" rel="noreferrer noopener">debug_information</a></code> filter, returning the array with a new index.</p>
<!-- /wp:paragraph -->

<!-- wp:code {"className":"php"} -->
<pre class="wp-block-code php"><code>function my_custom_health_info_section( $debug_info ) {
	$debug_info&#91;'section_slug'] = &#91;
		'label'  =&gt; __( 'My Custom Health Info Section', 'textdomain' ),
		'fields' =&gt; &#91;
			'field_slug_1' =&gt; &#91;
				'label' =&gt; __( 'Label 1', 'textdomain' ),
				'value' =&gt; 'value 1',
			],
			'field_slug_2' =&gt; &#91;
				'label' =&gt; __( 'Label 2', 'textdomain' ),
				'value' =&gt; 'value 2',
			],
		],
	];

	return $debug_info;
}
add_filter( 'debug_information', 'my_custom_health_info_section' );</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>The code above creates a new section, like the screenshot below:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2780,"width":765,"height":182,"sizeSlug":"full","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-full is-resized"><a href="https://felipeelia.com.br/wp-content/uploads/2023/01/new-wordpress-health-tools-section.png"><img src="https://felipeelia.com.br/wp-content/uploads/2023/01/new-wordpress-health-tools-section.png" alt="" class="wp-image-2780" width="765" height="182"/></a><figcaption class="wp-element-caption">Our new section in WordPress Site Health Info</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In the copy-and-paste report, our section looks like this:</p>
<!-- /wp:paragraph -->

<!-- wp:code {"className":"yaml"} -->
<pre class="wp-block-code yaml"><code>### section_slug ###

field_slug_1: value 1
field_slug_2: value 2</code></pre>
<!-- /wp:code -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Status reports in plugins</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Some plugins have their own status reports. That happens because they were created before WordPress added this functionality or because <strong>their reports are so complex that they don't fit into the WordPress structure</strong>, which has only one level of hierarchy.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">WooCommerce</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>WooCommerce's System Status is available under <em>WooCommerce &gt; Status</em>. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2782,"width":512,"height":257,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><a href="https://felipeelia.com.br/wp-content/uploads/2023/01/woocommerce-status-page.png"><img src="https://felipeelia.com.br/wp-content/uploads/2023/01/woocommerce-status-page-1024x513.png" alt="" class="wp-image-2782" width="512" height="257"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Some sections stand out there, like Database, Settings, and WooCommerce pages, super specific to the plugin. <strong>In WooCommerce, the copy-and-paste report stays visible</strong>, different from almost all other solutions available.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Gravity Forms</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Gravity Forms' System Report is available by going to <em>Forms &gt; System Status</em>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2783,"width":512,"height":195,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><a href="https://felipeelia.com.br/wp-content/uploads/2023/01/gravity-forms-status-page.png"><img src="https://felipeelia.com.br/wp-content/uploads/2023/01/gravity-forms-status-page-1024x389.png" alt="" class="wp-image-2783" width="512" height="195"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In addition to a section called Gravity Forms, the section Database (pretty much like WooCommerce's) <strong>lists all the plugin custom tables</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">ElasticPress</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The ElasticPress <em>Status Report</em> page was born from a support need and was inspired by several existent solutions. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2784,"width":512,"height":402,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><a href="https://felipeelia.com.br/wp-content/uploads/2023/01/elasticpress-status-report.png"><img src="https://felipeelia.com.br/wp-content/uploads/2023/01/elasticpress-status-report-1024x804.png" alt="" class="wp-image-2784" width="512" height="402"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In addition to extremely specific sections like <em>Indexable Content</em>, <em>Elasticsearch Indices</em>, and <em>Last Sync</em>, the ElasticPress report has another difference: <strong>an extra hierarchy level</strong>. There we have the <em>WordPress</em> section, for example, with the <em>WordPress Environment</em> and <em>Server Environment</em> subsections.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In this post we saw a new tool called <a href="https://felipeelia.dev/report-parser/"><strong>Report Parser</strong></a>, available here in the blog, to <strong>better visualize</strong> WordPress and its plugins' Status Reports.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We had a look at the Health Info from WordPress itself, the standard format used in all reports, and how it is possible to <strong>add your own section</strong> to WP's report.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>At last, we saw <strong>some plugins that have their own reports</strong> like WooCommerce, Gravity Forms, and ElasticPress.</p>
<!-- /wp:paragraph -->

<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->

<!-- wp:paragraph -->
<p>Don't forget to share the post and <strong>subscribe to the newsletter</strong>!</p>
<!-- /wp:paragraph -->