Home > Wordpress > Exec-PHP Plugin for WordPress

Exec-PHP Plugin for WordPress

In order to execute PHP code in your wordpress post, you will need a plugin that does that for you. I am using Sören Weber’s Exec-PHP plugin.


To install the Exec-PHP plugin:

  1. Download the Exec-PHP plugin archive and extract the files.
  2. Copy the resulting exec-php directory into /wp-content/plugins/ directory.
  3. Activate the plugin through the “Plugins” menu of WordPress (after a fresh installation only the Administrator is allowed to execute PHP code).
  4. Configure blog and user settings if needed.


With Exec-PHP you can execute PHP code in the excerpt and the content portion of your posts and pages (in the following called articles) as also as in text widgets. To execute code, just type in the PHP code as you usually would, encapsulated in <?php ?> tags.

What if I just want to print out PHP code and don’t execute it?

If you just want to print out code and don’t want to execute it, you have to make sure to convert your code to the correct XHTML representation. To do so you have to escape the following characters: < to &lt;, > to &gt;, and & to &amp;.

Categories: Wordpress Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.