Use PHP in WordPress

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.

6 thoughts on “Use PHP in WordPress”

  1. 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. . .. ๐Ÿ™

    1. 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.

    1. 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

Your email address will not be published. Required fields are marked *