Alex Hawkinson, Founder & CEO of BrightAI – Interview Series

Alex Hawkinson is the Founder and CEO of BrightAI, where he leads the mission to awaken critical infrastructure, transitioning operations from reactive to proactive. With over 25 years of experience in IoT, AI, SaaS, and cloud-based technologies, Alex leverages his expertise to transform industries with intelligent,…

XPANCEO’s Smart Contact Lenses Merge Digital and Physical Worlds

Founded in 2021, XPANCEO has emerged as a pioneer in reimagining how we interact with technology. Unlike companies developing the next generation of smartphones or laptops, XPANCEO is taking a fundamentally different approach: computing that sits directly on your eye. At Mobile World Congress (MWC) 2025,…

Deepgram Nova-3 Medical: AI speech model cuts healthcare transcription errors

Deepgram has unveiled Nova-3 Medical, an AI speech-to-text (STT) model tailored for transcription in the demanding environment of healthcare. Designed to integrate seamlessly with existing clinical workflows, Nova-3 Medical aims to address the growing need for accurate and efficient transcription in the UK’s public NHS and…

How to Improve Custom WordPress Plugins with Plugin Check – Speckyboy

Custom plugins are part of what makes WordPress so flexible. If you need functionality that doesn’t exist in the ecosystem, you can build it yourself. That allows you to create websites that suit your needs.

Still, it’s important to get the details right. Any custom code you write should be secure and performant. It should also adhere to the guidelines set forth by WordPress. Doing so ensures your plugin works as expected and won’t cause harm.

So, how do you know if your code passes the litmus test? There’s a helpful tool that can alert you to any issues.

Plugin Check (PCP) is a plugin that performs an automated review of your code. It checks to see if your plugin uses best practices for security, internationalization, and performance. From there, it generates a report you can use to make improvements.

Plugin Check is intended to help developers meet the standards of the WordPress plugin directory. However, it’s also useful for anyone building a custom plugin for their project.

Today, we’ll show you how to use Plugin Check to review your plugin. It’s a quick and easy way to ensure quality.

Let’s Check a Homemade Plugin

I built a WordPress plugin called Handy Links Custom Dashboard Widget that (you guessed it) adds a custom widget to a site’s dashboard. I use it on client projects to provide quick access to common tasks. For example, links for adding a new post or viewing form entries. It saves them from searching through the navigation.

The code is far from a work of art. I built it with the help of AI and a few snippets I’ve collected. It works, and that makes me happy. But I’d like to improve the code.

Let’s see if Plugin Check can help. I have installed and activated it on a test site. Now, it’s time to start testing.

Step 1: Check the Custom Plugin

The first step is to run my custom plugin through Plugin Check’s interface. That can be found by navigating to Tools > Plugin Check in the WordPress admin area.

I’ll select my plugin (Handy Links Custom Dashboard Widget) from the drop-down menu. Then, I can choose from one or more types of code audits:

  • General
  • Plugin Repo
  • Security
  • Performance
  • Accessibility

I’ll go with the Plugin Repo option, as it runs an all-encompassing check. It will tell me what items to fix to match the WordPress plugin directory guidelines. That’s a great place to start.

How to Improve Custom WordPress Plugins with Plugin Check – Speckyboy

Step 2: Analyze the Results

Plugin Check’s analysis pointed out several errors in my plugin. A few were relatively minor and located in the plugin’s readme file:

  • Plugin name header in your readme is missing or invalid. Please update your readme with a valid plugin name header. Eg: "=== Example Name ==="
  • Mismatched Stable Tag: 6.0 != 1.0
    Your Stable Tag is meant to be the stable version of your plugin, and it needs to be exactly the same as the version in your main plugin file’s header. Any mismatch can prevent users from downloading the correct plugin files from WordPress.org.
  • The “Tested up to” field was ignored. This field should only contain a valid WordPress version such as “6.7” or “6.8”.

There were also a few security-related items that caught its attention:

  • All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$widget_text'.
  •  All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.

The suggestion here is to escape the plugin’s output to ensure no malicious code is executed. Plugin Check links to the WordPress documentation to provide more details.

Plugin Check reported errors in my plugin's readme file, along with some security issues

Step 3: Make the Suggested Changes

Making changes requires a bit of research. Thankfully, Plugin Check reports the locations of each issue within the plugin’s code, including the line and column numbers. It also provides links to the relevant documentation.

We’ll use the suggested security fixes as an example. Plugin Check reported issues in the following spots. I’ve included the code snippets below for reference.

Before Fixing

Line 47:

<?php echo $widget_text; ?>

Line 80:

<?php _e( 'Widget Title', 'handylinks-custom-dashboard-widget' ); ?>

Line 84:

<?php _e( 'Widget Text', 'handylinks-custom-dashboard-widget' ); ?>

None of these snippets are using an escaping function. That means a hacker could execute malicious code. I’ve consulted the documentation and implemented the following changes:

After Fixing

Line 47:

<?php echo wp_kses_post($widget_text); ?> // Accept any code that is allowed in a WordPress post.

Line 80:

<?php echo esc_html(_e( 'Widget Title', 'handylinks-custom-dashboard-widget'  )); ?> // Strip all HTML input.

Line 84:

<?php echo esc_html(_e( 'Widget Text', 'handylinks-custom-dashboard-widget'  )); ?> // Strip all HTML input.

Step 4: Re-Test the Plugin

I’ve made the suggested changes to my plugin. Now, it’s time to retest and see if the plugin fares better.

It’s a success! The plugin now passes muster for security and readme file formatting. That’s a relief.

Plugin Check has deemed my plugin to meet WordPress plugin repository standards

Plugin Check Ensures Quality Code

Plugin Check’s most impressive feat is its efficiency. The tool shows you where problems exist and provides background details on fixing them. You won’t waste time searching for potential issues.

The process of testing and improving my plugin took about 30 minutes. Your times may vary based on the size of your plugin and the number of issues found. Regardless, Plugin Check will help you find things you may have missed.

It’s worth making this tool a part of your WordPress development workflow. Ensuring quality code keeps your site safe and performant. That peace of mind benefits everyone!

Related Topics


Top

Denis Ignatovich, Co-founder and Co-CEO of Imanda – Interview Series

Denis Ignatovich, Co-founder and Co-CEO of Imandra, has over a decade of experience in trading, risk management, quantitative modeling, and complex trading system design. Before founding Imandra, he led the central risk trading desk at Deutsche Bank London, where he recognized the critical role AI can…

Opera introduces browser-integrated AI agent

Opera has introduced “Browser Operator,” a native AI agent designed to perform tasks for users directly within the browser. Rather than acting as a separate tool, Browser Operator is an extension of the browser itself—designed to empower users by automating repetitive tasks like purchasing products, completing…