Title: How to add php code?
Last modified: March 1, 2022

---

# How to add php code?

 *  [georgebrianb](https://wordpress.org/support/users/georgebrianb/)
 * (@georgebrianb)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/how-to-add-php-code-3/)
 * Hello,
 * I am trying to add php code but it asks me to escape the characters used.. adding
   <script> tags works, but adding <?php //content here ?> is not working..
 * I am trying to do something like this at least:
 * `<?php echo "Hello World" ?>`
 *  [Here’s an example](https://prnt.sc/uLC_fhciWK7U)
 * Also, I don’t know how to run both PHP and JS in the same script? Or in the body
   at the same time.

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

 *  [ride2719](https://wordpress.org/support/users/ride2719/)
 * (@ride2719)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-php-code-3/#post-15807217)
 * I am having the same problem with exactly the same error report when trying to
   add code to the footer. I tried replacing < with < and > with > and the plugin
   editor seemed to like it, however when I clicked the save button it replaced 
   the ampersand codes with the original characters. However it did save the code,
   but when you look at the page the php snippet did not do anything. I was trying
   to produce a copyright notice using PHP to insert the current year. It looks 
   like this: “<p>&copy 2014 – <?php echo date(‘Y’); ?> mysite.org</p>” — trying
   to produce “copyright 2014 – 2022”. Needless to say, it is important to be able
   to insert PHP scripts.
 *  [ride2719](https://wordpress.org/support/users/ride2719/)
 * (@ride2719)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-php-code-3/#post-15807231)
 * Oops this editor did the same thing, i.e. it replaced the ampersand-lt; and ampersand-
   gt; with the two characters. The sentence with <‘s and >’s doesn’t make sense
   for this reason. Obviously my attempt to use html character encoding is not helpful.

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

The topic ‘How to add php code?’ is closed to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [js](https://wordpress.org/support/topic-tag/js/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 2 participants
 * Last reply from: [ride2719](https://wordpress.org/support/users/ride2719/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-php-code-3/#post-15807231)
 * Status: not resolved