A Simple WordPress Plugin Tutorial for beginner WordPress Developer

There are no needs to describe what you can do with a WordPress Plug-in. We all know that it’s a dominant feature to extend theme functionality or add one or more new functions to a website. I will not describe the plug-in structure in this article because it is a simple plugin tutorial for beginners. The aim of this article is influencing a very beginner developer to code their first plug-in. If you are interested in writing more plug-ins, you can use WordPress Codex respectfully. 🙂

Here, we are going to create a simple plug-in to make our post title automatically in uppercase format. For instance, if I write “my new post” in the WordPress title field it will be automatically transformed into “My New Post.” So, you do not have to give extra attention to post titles while publishing a new post in WordPress.

Create a new folder in your plug-in directory and rename it as “title-uppercase.” Make sure that there are no spaces or other characters in the name of your folder.

Create a new .php file and open it with notepad or your favorite code editor. Now add the header information for your plug-in.

Here is the header information for This plug-in is:

/*
Plugin Name: Title Filter
Plugin URI: https://www.varyhelp.com/
Description: To change the beginning font of every word in uppercase from the post title.
Version: 0.1
Author: Vh Admin
Author URI: https://www.varyhelp.com
*/

Go to your plugin page in the admin panel, and you will see that the information about your newly created plugin is presented in the plugin information table.

We know that WordPress defines a post title by this tag the_title. Now we can create a filter to pass the default format of the_title tag.

add_filter('the_title','title_filter');
function title_filter($content){
return ucwords($content);
}

What we did by this code:
In the above code, we pass ucwords (that means uppercase words) through the_title tag. And use a function named title_filter to achieve this result. We can also write this code shortly:

add_filter('the_title', ucwords)

Full Plugin Code:

<? php 
    /*
    Plugin Name: Title Filter
    Plugin URI: https://www.varyhelp.com
    Description: To change the beginning font of every word in uppercase from the post title.
    Version: 0.1
    Author: VH Admin
    Author URI: https://www.varyhelp.com */
function title_filter($content)
add_filter('the_title','title_filter'); {
 return ucwords($content);
}
?>

Or,

<? php 
    /*
    Plugin Name: Title Filter
    Plugin URI: https://www.varyhelp.com
    Description: To change the beginning font of every word in uppercase from the post title.
    Version: 0.1
    Author: VH Admin
    Author URI: https://www.varyhelp.com */
add_filter('the_title', ucwords);
?>

Note: this plugin is not compatible with WordPress Multisite.