Support » Plugin: Per page add to head » Inserting PHP

  • Resolved rpwk


    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?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Erikvona


    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:

    	echo stripslashes_deep($addtoheadcontent);

    should be changed to:


    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.

    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.