Title: Where To Place PHP Code
Last modified: August 19, 2016

---

# Where To Place PHP Code

 *  [maryandpaul](https://wordpress.org/support/users/maryandpaul/)
 * (@maryandpaul)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/where-to-place-php-code/)
 * I have inserted some HTML in a page which references PHP code that I’ve written.
   Where can I place the PHP code so that the HTML code can access it. I don’t want
   to have it inline with the HTML code.

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

 *  [figaro](https://wordpress.org/support/users/figaro/)
 * (@figaro)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/where-to-place-php-code/#post-1060421)
 * php is server-side code…you will need to have your php in a file on the server.
   If you explain what you are trying to do, then maybe someone can better help…
   I’m not sure what you mean when you say you want the “html code to access it.”?
 *  Thread Starter [maryandpaul](https://wordpress.org/support/users/maryandpaul/)
 * (@maryandpaul)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/where-to-place-php-code/#post-1060423)
 * When I access the web page with the HTML code it references PHP code that I have
   written. I will place the PHP code in my WordPress application on the server,
   but I need to know where to place it so that it will be in the path of the HTML
   code. I don’t want to place it inline with the HTML.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/where-to-place-php-code/#post-1060551)
 * That’s the wrong way around. HTML can’t reference, call or include a PHP file.
   A PHP script, on the other hand, can include external HTML files.
 * I’d suggest placing both sets of files in your current theme folder.
 *  [buddiemac](https://wordpress.org/support/users/buddiemac/)
 * (@buddiemac)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/where-to-place-php-code/#post-1060901)
 * I have implemented and seen php scripts inside html code. The web server requires
   to be instructed to parse the html for PHP scripts, then execute them on the 
   server and then serve the content to the client.
 * For apache servers, there are a few ways of doing this, one common way is using
   these apache’s handlers:
 * AddType application/x-httpd-php .php .htm .html
    RemoveHandler .html .htm
 * Though for wordpress, I would like also to add php scripts or any server side
   scripting, to deliver content on post and other wordpress pages so to maximize
   SEO.

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

The topic ‘Where To Place PHP Code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 4 participants
 * Last reply from: [buddiemac](https://wordpress.org/support/users/buddiemac/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/where-to-place-php-code/#post-1060901)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
