Title: Insert PHP Code in Rich Editor
Last modified: August 18, 2016

---

# Insert PHP Code in Rich Editor

 *  [pweaver](https://wordpress.org/support/users/pweaver/)
 * (@pweaver)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/)
 * I am trying to insert php code using the Rich Editor with the latest version 
   of WordPress.
 * To do this I have download and installed a copy of [Exec-php](http://soeren-weber.net/post/2005/08/18/50/)
   which allows me to insert php code with the tags `<?php ?>` or `[?php ?]`. It
   is recommended on the page I use the second if I’m using the Rich Editor because
   it will destroy the code otherwise.
 * What i’m finding is that there appears to be no way to fully counteract the automatic
   changes of the editor. It puts in `<br />` tags after each line, it automatically
   parses anything within `< >` tags, so if I want to echo an html tag, it is echo’d
   immediately to the text page, rather than when the php calls it.
 * The functionality of the rich editor ( Gallery2 Support for example ) is great,
   but it seems like people wanting to do anything other than put text and images
   in posts get left out..
 * Does anyone have a solution for this?
 * My apologies if my post comes out misformed, first post..

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/#post-337340)
 * RTE is not for people who want to write their own code.
    You either use the normal
   html editor and put in your code – or use the RTE and forget about writing code
   into the content.
 *  [puppy18](https://wordpress.org/support/users/puppy18/)
 * (@puppy18)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/#post-337346)
 * yep, u need to turn off your RTE.
 *  [ryebrye](https://wordpress.org/support/users/ryebrye/)
 * (@ryebrye)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/#post-337347)
 * Could you just hit the “HTML” button and edit the source – paste it in there –
   or would the RTE still jack it up when you applied your changes to the source
   and then played around in the RTE?
 *  [Chris_K](https://wordpress.org/support/users/handysolo/)
 * (@handysolo)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/#post-337349)
 * RTE would still “jack it up” when you Submit.
 *  Thread Starter [pweaver](https://wordpress.org/support/users/pweaver/)
 * (@pweaver)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/#post-337464)
 * Thanks for the responses guys.
 * Looks like in order to use things like WPG2 ( WordPress Gallery2 Plugin ) I’ll
   have to add the image first in the rich editor, then swap out if I want to fiddle
   with anything else.
 * Yes it’s lazy using the plugin to insert thumbnails and whatnot, but it’s so 
   very convenient.
 * Again, My thanks to all who replied.

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

The topic ‘Insert PHP Code in Rich Editor’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 5 participants
 * Last reply from: [pweaver](https://wordpress.org/support/users/pweaver/)
 * Last activity: [20 years, 3 months ago](https://wordpress.org/support/topic/insert-php-code-in-rich-editor/#post-337464)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
