Title: Inserting PHP
Last modified: August 21, 2016

---

# Inserting PHP

 *  Resolved [rpwk](https://wordpress.org/support/users/rpwk/)
 * (@rpwk)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/inserting-php/)
 * Hi – this plugin would work perfectly for me, however I cannot insert PHP code
   into the header using this as the tags are getting stripped.
 * I’m trying to add a PHP include on a per page basis to the head that interacts
   with javascript files which load content at the bottom of the page (product reviews.)
 * Can you actually add PHP using the plugin or am I completely out of my mind?
 * Thanks!
 * [https://wordpress.org/plugins/per-page-add-to/](https://wordpress.org/plugins/per-page-add-to/)

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

 *  Plugin Author [Erikvona](https://wordpress.org/support/users/erikvona/)
 * (@erikvona)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/inserting-php/#post-4962035)
 * You can’t insert PHP into a post or page with this plugin, sorry.
 * As far as I know, there are no plugins that can do this. You could try to modify
   my plugin for this purpose, but the results will probably be unexpected.
 * Try changing the following:
    Line 93 through 95 of perpagehead.php:
 *     ```
       if(!empty($addtoheadcontent)){
       	echo stripslashes_deep($addtoheadcontent);
       }
       ```
   
 * should be changed to:
 *     ```
       if(!empty($addtoheadcontent)){
       	eval(stripslashes_deep($addtoheadcontent));
       }
       ```
   
 * This will cause EVERYTHING you put in the box to be evaluated as PHP (as if it
   was inside <?php ?> tags , so use ?> HTML here <?php to put html in). However,
   using the eval() function is usually a bad idea, I haven’t tried it, and won’t
   support it. Also, this causes non-admins to be able to execute PHP code on your
   webserver, so it seriously compromises security (if you can execute PHP, you 
   can empty the SQL database, delete and modify users, promote yourself to admin,
   take over the site etc.).
 * To be short: this is a very bad idea, you shouldn’t do this, but if you still
   want to, this is the way.
 *  Thread Starter [rpwk](https://wordpress.org/support/users/rpwk/)
 * (@rpwk)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/inserting-php/#post-4962037)
 * LOL, thanks Erik for the speedy reply. If I could find someway to pass simple
   variables to the reviews array I could just include it once in the header and
   then enter the variables on a per page basis but that is a totally different 
   thing. Thanks again!

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

The topic ‘Inserting PHP’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/per-page-add-to.svg)
 * [Per page add to head](https://wordpress.org/plugins/per-page-add-to/)
 * [Support Threads](https://wordpress.org/support/plugin/per-page-add-to/)
 * [Active Topics](https://wordpress.org/support/plugin/per-page-add-to/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/per-page-add-to/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/per-page-add-to/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [rpwk](https://wordpress.org/support/users/rpwk/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/inserting-php/#post-4962037)
 * Status: resolved