Safe way of using Wordpress Plugins

Many of wordpresss plugins requires you to edit the theme files and ask you to add lines like these -

<?php wp_related_posts(); ?>

(this cod is for wordpress related links plugin which I just installed by the way). Now the problem with putting such lines of php codes in theme files is that once when you disable the plugin or remove it, your blog will break as php parser will look for the function which is not there anymore.

The safe way of using wordpress plugin and more importantly while adding/editing theme files always use if statement like this -

<?php if ( function_exists('wp_related_posts') ) {
wp_related_posts(); } ?>

so first you are checking for whether the function exist or not and if the function exist, only then the function will be executed. So now even if you disable the function (i.e. plugin) the site won’t broke. Most of the time, the function name will be plugin name too.

Related posts:

  1. Change order of Wordpress Pages in Menu By default every wordpress theme shows the list of pages...
  2. 3 Best Wordpress Security Plugins As long as your wordpress files are up to date...
  3. 5 Wordpress Plugins for Adsense Wordpress offers lot of adsense plugins which you can use...
  4. Wordpress not sending email to Comment subscribers, use WP Mail SMTP Plugin lot of web hosts (like mine too) disables php mail()...
  5. 5 Wordpress Plugins to Increase the Performance of your Blog Wordpress has about 20 plugins which you can use to...


Liked this post ? Subscribe to MWolk Blog via RSS Feed or via Email and receive free daily Tech and Money making tips.

2 Responses to “Safe way of using Wordpress Plugins”

  1. 1God of War on Mar 15, 2009 :

    thanks for the tip, By the way, which wordpress module you are using to show that php colors ?

  2. 2admin on Mar 15, 2009 :

    That plugin is known as wp-syntax, You can download it from here. Its a great plugin if you often uses programming codes in your wordpress blog posts.

Leave a Reply

Name Email Website URI