Learn by easy steps


The is a very simple tutorial for creating WordPress plugin. The plugin will replace some specific word by other words and add a pre-defined text for new post.


1. Go to the plugin folder and create a new folder for your new plugin. Here, testplugin folder is created.

2. Create a file named testplugin.php inside that folder.

3. Add the following text as comment in the file.

Plugin Name: testPlugin
Plugin URI: https://fahmidasclassroom.com/
Description: Plugin Version: 1.0
Author: Fahmida
License: GPLv2 or later

4.  Add the following function in the file to replace the content of the text.

function replace_content( $content ) {
$search = array( 'wordpress', 'jquery', 'angularjs', 'css','php' );
$replace = array( 'WordPress', 'jQuery', 'AngularJS', 'CSS3','PHP' );
return str_replace( $search, $replace, $content );
add_filter( 'the_content', 'replace_content' );

5. Go to the dashboard and activate the plugin.

6. Refresh the dashboard and create a post that contains words like wordpress, jquery, angularjs, php and css.

7. Publish the post and check the view.

8. Add the following function to add a predefined footer for each post.

function add_footer_content( $content ) {
$content .= '<p>Thank you for reading this post. </p>';
return $content;
add_filter( 'the_content', 'add_footer_content' );

9. Create another post, refresh the dashboard and check the view.

For another plugin tutorial click here.