Sometimes, it becomes necessary to run a PHP code in your wordpress posts or pages to display a plugin output or for other reasons to make use of wordpress as a powerful CMS. There are virtually countless plugins which allow you to run PHP in wordpress.

WordPress PHP exec” is a plugin that lets you execute dynamic PHP code in posts. It masks PHP code before balanceTags, and unmask them afterwards, so it should be safe to use PHP code that has literal HTML tags in it, for example: code which print out HTML.

For example, you can put you PHP codes like

<phpcode>
<?php
echo “Current date and time: “;
echo date(“l dS of F Y h:i:s A”);
?>
</phpcode>

and get your output inside your page/post.

Download PHP Exec Plugin for Wordress here.


For updates on Use PHP in WordPress
Enter your email here:

6 Comments

Leave a Comment · TrackBack · RSS Comments

  1. Comment by Anish K.S on July 6, 2009

    Thanks Anand, will check it.

  2. Comment by Anand on July 6, 2009

    Glad to be of help…i used to take this plugin for granted until recently :)

  3. Comment by Jamie on July 6, 2009

    is it possible for every one to put in php codes into a post? I do not want my readers to insert php codes and spoil my blog. . .. :(

  4. Comment by Anand on July 6, 2009

    ah….these php codes in wordpress work only when you are putting up a post. Not in the comments section. Also, they work only for the authorized authors like the admin. Normal authors cannot do it.

  5. Comment by Pallab on July 6, 2009

    I have been using this plugin for a long time. If you want to use php in widgets you can do so using Executable PHP Widgets : http://wordpress.org/extend/plugins/php-code-widget/

  6. Comment by Anand on July 7, 2009

    using php in wordpress widgets is a rocking idea for those who might not be interested in learning code to implement a plugin….thanks @pallab! :)

Leave a comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes