How to create a simple wordpress plugin?

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Wordpress Plugin Tutorial  //  No Comments

The simple plugin to create wordpress plugin is given below.


<?php
/*
Plugin Name: My Plugin
Plugin URI: http://foobar.co.uk/
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Foo
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/


function my_function($text)
{
    return str_replace('Foo', 'Bar', $text);
}

add_filter('the_content', 'my_function');
?>

plugin that replaces any post containing the word “Foo” with the word “Bar”.a terrible example, but its far from unachievable.

Leave a comment

Share This Post

RSS Wordpress News