WordPress: call function from functions.php OR write plugin, which one better?

To extend wordpress and make pages loaded fast (best performance), we should write a new function and put in WP-THEME/functions.php or write a new plugin? Which way is better?

Thanks,

Read More

–Joanson

Related posts

Leave a Reply

4 comments

  1. I am willing to bet that if we are exclusively looking at performance, writing the function in functions.php is going to be easier and a better option for you. Also note that the plugin could be used across all themes etc… if you’re going to have a mobile theme etc… whereas the functions.php is only usable within the theme you placed the function in.

    Happy coding!

  2. I find myself reusing a lot of custom built functions across wordpress sites. I create an includes folder and comment in and out what I need for that particular site from the functions.php file.

  3. there’s a big difference in choosing to create a plugin or a function. is it using across several theme’s? is it theme oriented or site oriented? maybe you’ll use it in future projects?

    a great solution is the mu-plugins, an must-use always-running plugins, that runs before the regular plugins. you can find more information in these links:

    http://codex.wordpress.org/Must_Use_Plugins

    http://justintadlock.com/archives/2011/02/02/creating-a-custom-functions-plugin-for-end-users

    Further more, i advise you to go and read the following excellent article, it will help you to decide:

    http://wpcandy.com/teaches/how-to-create-a-functionality-plugin