How to Run PHP in WordPress Posts and Pages

By default WordPress doesn’t allow you to execute PHP scripts from within the post and page editors. Exec-PHP is the solution. The Exec-PHP plugin executes PHP code in posts, pages and text widgets.


  • Executes PHP code in the excerpt and the content portion of your posts and pages
  • Configurable execution of PHP code in text widgets (for WordPress 2.2 or higher)
  • Write PHP code in familiar syntax, eg. <?php ... ?>
  • Works in your newsfeeds
  • Information about which users are allowed to execute PHP with the current security settings (for WordPress 2.1 or higher)
  • Configurable user warnings for inappropriate blog and user settings (for WordPress 2.1 or higher)
  • Restrict execution of PHP code in posts and pages to certain users by using roles and capabilities
  • Update notifications through the ‘Plugins’ menu in WordPress if a new version of the Exec-PHP plugin is available (for WordPress 2.3 or higher)
  • Internationalization support (english and german included, many more available)
  • Comes with documentation

For support and further information about the Exec-PHP plugin see the plugins homepage at

About Jean Galea

Jean Galea is a WordPress developer, podcaster and entrepreneur. He is the founder of WP Mayor and WP RSS Aggregator. His personal blog can be found at Check out his podcast focused on doing business with WordPress over at

2 Responses

  1. radiant heat flooring
    radiant heat flooring April 13, 2011 at 22:30 | | Reply Thanks for that awesome posting. It saved MUCH time 🙂

  2. Brent Lagerman
    Brent Lagerman July 11, 2012 at 17:55 | | Reply

    we just made a new role ‘editor’ for our site and transitioned all posts over to the new role, all of a sudden we could see PHP in the pages, this post helped me realize that there’s a capability for exec-php in the role editor. Thanks for the post, hopefully it helps others too.


Leave a Reply

Please enter an e-mail address