Title: Adding raw PHP into pages &#8211; bad practice?
Last modified: August 20, 2016

---

# Adding raw PHP into pages – bad practice?

 *  [hamsterleg](https://wordpress.org/support/users/hamsterleg/)
 * (@hamsterleg)
 * [14 years ago](https://wordpress.org/support/topic/adding-raw-php-into-pages-bad-practice/)
 * Run a few WP sites, used some new developers for this one – they have added PHP
   into all pages, mostly to add images.
 * For example:
 * <img src=”<?php bloginfo(‘template_url’); ?>/images/facebook.png” alt=”” />
 * As such we get lots of warnings that saving this article will render all contained
   PHP code permanently unuseful.
 * Compared to me, they are supposedly the experts at WP, but that seems wrong to
   me?
 * Any opinions greatly welcome.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Phil](https://wordpress.org/support/users/owendevelopment/)
 * (@owendevelopment)
 * [14 years ago](https://wordpress.org/support/topic/adding-raw-php-into-pages-bad-practice/#post-2728193)
 * Have they installed a plugin called [Exec-PHP](http://wordpress.org/extend/plugins/exec-php)?
 * This plugin does allow php to run in pages and posts and does also throw the 
   warning up. It’s a workaround I guess, but I personally prefer to create a new
   page template with the php code already in – rather than adding it to posts. 
   Means you have one less plugin running on the site too.
 *  Thread Starter [hamsterleg](https://wordpress.org/support/users/hamsterleg/)
 * (@hamsterleg)
 * [14 years ago](https://wordpress.org/support/topic/adding-raw-php-into-pages-bad-practice/#post-2728194)
 * Yes they have installed Exec-PHP.
 * For a lot of other sites, we just add the images via wordpress, have never seen
   this method used.
 *  [Phil](https://wordpress.org/support/users/owendevelopment/)
 * (@owendevelopment)
 * [14 years ago](https://wordpress.org/support/topic/adding-raw-php-into-pages-bad-practice/#post-2728196)
 * It’s a lazy way of doing things:
 * Why use php to get the path of /wp-content/themes/yourtheme/images/facebook.png
   when you can just type it like I just did?
 * The more PHP calls and the more plugins your site is using will gradually slow
   your site down.
 *  Thread Starter [hamsterleg](https://wordpress.org/support/users/hamsterleg/)
 * (@hamsterleg)
 * [14 years ago](https://wordpress.org/support/topic/adding-raw-php-into-pages-bad-practice/#post-2728198)
 * Thanks, lazy is exactly what I figured!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding raw PHP into pages – bad practice?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [hamsterleg](https://wordpress.org/support/users/hamsterleg/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/adding-raw-php-into-pages-bad-practice/#post-2728198)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
