From RPG to PHP: An IBMi Programmers Guide to Building Your First WordPress Plugin

  • Home
  • /
  • Blog
  • /
  • From RPG to PHP: An IBMi Programmers Guide to Building Your First WordPress Plugin

September 9, 2025

From RPG to PHP: An IBMi Programmers Guide to Building Your First WordPress Plugin

By NickLitten

September 9, 2025

plugin, RPGLE, wordpress

If you’re an IBM i developer like me; used to the structured world of RPGLE, CL, and SQL, venturing into WordPress plugin development might feel like stepping into a carnival of loosely typed chaos. But fear not. Underneath the glitter and JavaScript, WordPress is just another system with hooks, APIs, and a predictable lifecycle. This blog is for me to keep track of my first steps into the world of PHP Plugin Development and a reminder that I can actually keep things clean, logical, and well-commented.

Before we dive in, make sure we’ve got the basics covered:

Local WordPress setup: If you don’t have your own WordPress server up here in the cloud then use LocalWP for quick easy local setups of WordPress.

From RPG to PHP: An IBMi Programmers Guide to Building Your First WordPress Plugin 1

Text editor: VS Code works well. If you’re nostalgic for SEU, you’ll miss the green screen so consider something simple like NOTEPAD++ – but trust me with VS-Code its free, simple to use and has robust syntax highlighting which helps a lot!

Basic PHP knowledge: Think of it as RPGLE with fewer rules and more dollar signs. Seriously, if you are an RPGLE Programmer – you will find PHP easy to understand.

Admin access to WordPress: You’ll need this to activate and test your plugin. You can use your localwp install, or your own wordpress in the cloud (I am going to use this website as the example)

Get Ready to Code: I added the excellent PHP Tools for Visual Studio Code to my VS-Code setup. Simply click Extensions and type devsense All-in-One PHP support in the search and install it:

From RPG to PHP: An IBMi Programmers Guide to Building Your First WordPress Plugin 2

Step 1: Create Your Plugin Skeleton

Navigate to your WordPress install’s plugin directory /wp-content/plugins/

/wp-content/plugins/

Create a new folder for your plugin. Let’s call it ibmi-admin-message

Inside that folder, create a PHP file named ibmi-admin-message.php

This is your entry point, just like a MAIN RPGLE main procedure.

Add this header block at the top:

<?php
/*
Plugin Name: IBM i Admin Message
Description: Adds a custom message to the top of your WordPress Admin Screen.
Version: 1.0
Author: Nick Litten
*/

This tells WordPress, “Hey, I’m a plugin.” Without it, your code won’t show up in the admin panel.

Step 2: Hook Into WordPress

WordPress runs on a clever system of hooks, which are essentially built-in trigger points that let developers insert their own code into the WordPress core without modifying it directly. These hooks come in two flavors: actions and filters and they’re the secret sauce behind most plugins and customizations.

Think of them like user exits or triggers. These hooks let us execute custom code at specific points in WordPress’s lifecycle.

For example we can:

  • Send an email when a post is published.
  • Add a custom message to the admin dashboard.
  • Enqueue scripts and styles.

For this example, let’s send a very simply custom message to the admin dashboard

Before we start, consider some best practices for clean code

  • Prefix everything: Use ibmi_ or your initials to avoid conflicts.
  • Comment generously: Future-you will thank you.
  • Sanitize inputs: If you add forms later, use sanitize_text_field() and friends.
  • Use version control: Git is your friend. Even if you’re the only developer.

Let’s add a simple header message to our admin screen:

function ibmi_admin_message()
 {
   echo '<h3 style="text-align:center;">Woooooo! I am powered by IBM i and WordPress</h3>';
 }

add_action('admin_head', 'ibmi_admin_message');

Note the add_action(‘admin_head’ is the call to an internal WordPress hook : This is the equivalent of saying: “When WordPress hits the admin screen, run my function.”

Now you should have a simple folder, with one file in it something like this:

From RPG to PHP: An IBMi Programmers Guide to Building Your First WordPress Plugin 3

Add Safety Nets

Always prevent direct access to your plugin file:

if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}

This is like adding a validity check in your RPGLE program to avoid unexpected calls.

What does our final plugin code look like?

<?php
/*
Plugin Name: IBM i Admin Message
Description: Adds a custom message to the top of your WordPress Admin Screen.
Version: 1.0
Author: Nick Litten
*/

if (!defined('ABSPATH')) {
  exit; // Exit if accessed directly
}

/*
Define a function named 'ibmi_admin_message' which we can trigger at anytime
*/
function ibmi_admin_message()
{
  echo '<h3 style="text-align:center;">Woooooo! I am powered by IBM i and WordPress</h3>';
}

/* 
admin_head: Targets the backend/admin dashboard 
*/
add_action('admin_head', 'ibmi_admin_message');

Step 3: Activate and Test

Go to Plugins > Installed Plugins in your WordPress admin.

Find “IBM i Admin Message” and click Activate.

Visit your site and got your admin screen (https://www.yoursite.com/wp-admin) and you should see your message.

If not, check your syntax. PHP is unforgiving about missing semicolons.

Step 6: Package It Up

If you want to share your plugin:

  • Zip the folder.
  • Add a readme.txt with usage instructions.
  • Submit to the WordPress Plugin Directory if you’re feeling generous.

And that’s it!

As IBM i developers, we’re used to systems that run for decades without a hiccup. WordPress isn’t quite that, but with the right discipline, you can bring some of that reliability to the web world.

Plugins are a great way to start playing with PHP, try this technique with something small, modular, and instantly rewarding.

If you build something cool, drop me a line. I’d love to see how you’re blending legacy muscle with modern flair.

Ready to test this and see it in action?

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>