Archive for October, 2010

I have seen this error thrown up many many times while activating a wordpress plugin and the

Plugin could not be activated because it triggered a fatal error.

Fatal error: Cannot redeclare similar_posts() (previously declared in /home/pbu/public_html/blog/wp-content/plugins/xxxx/xxxx:45) in /home/pbu/public_html/blog/wp-content/plugins/x/xxxx.php on line 46

The main reason why the plugin could not be activated is because there must be either a plugin clash using same function or a wordpress theme calling the plugin function using the same name ie. double declaration.

I was working with rewriting a custom rule for my wordpress plugin and i had a strange problem.

function aff_add_rewrite_rules( $wp_rewrite )
  $new_rules = array(
     '^redirect/([0-9]+)/$' => 'index.php?go=$matches[1]'); //question mark ? resolves the problem

  $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;


If you have a good old version of version of wordpress, then most probably you dont have automatic upgrade option and you have to do the upgrade manually. All new versions of wordpress have automatic upgrade option where you have to go to wp-admin > Tools > upgrade and all done with one click.

Here are the instructions you should follow if you are upgrading your wordpress from older versions.


How to write a WordPress Plugin?

Posted: October 30, 2010 in Wordpress

WordPress is not just a blogging platform and it is such a powerful CMS with unlimited capabilities, besides having a huge user base. Almost anything can be scripted with wordpress. You can extend wordpress either by means of plugin or by a theme.

In this tutorial, i will show you how to write a Hello World wordpress plugin, which unlike many believe is surprisingly easy, once you understand the very fundamentals. All you need to have is a basic knowledge of php scripting.

Before we move on coding a plugin, please make sure you remember the following coding practices.


Alright, this the fourth lesson of the WordPress tutorial series. I shouldn’t have to say it, but I’ll say it one last time; make sure you read the previous lessons. Otherwise, you will not understand one thing in this lesson. We have a quick lesson today to wrap up the header template and introduce the box model.

Step 1:
– Start Xampp control
– Open the theme’s folder, named Tutorial
– Open a browser, point it to http://localhost/wordpress
– Go back to the theme folder, open index.php in Notepad