Title: how do you stop visual editor from striping or changing &quot;&gt;&quot; php code
Last modified: August 20, 2016

---

# how do you stop visual editor from striping or changing ">" php code

 *  [barbaricht](https://wordpress.org/support/users/barbaricht/)
 * (@barbaricht)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/how-do-stop-visual-editor-from-striping-or-changing-php-code/)
 * If i enter this code
    <?php echo site_url(); ?>
 * in the HTML editor and switch to visual editor the php characters < > are replaced
   by HTML character entities, which renders the code useless.
 * I need to have both editors available.
 * thank you,
    -tony

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

 *  [Clayton James](https://wordpress.org/support/users/claytonjames/)
 * (@claytonjames)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/how-do-stop-visual-editor-from-striping-or-changing-php-code/#post-3245688)
 * ‘Yep. flipping between editors will often change code you entered in HTML mode.
 * Also, you probably cannot enter php code in the visual editor and expect it to
   run, as a general rule of thumb. Generally speaking,I don’t think PHP code will
   run by default from a post or a page when entered from the visual _or_ the HTML
   editor (if that’s your goal).
 * Perhaps you need a plugin that will allow you to run php from a post or page?
   Or are you just trying to post code snippets for display in an article?
 * A general search: [http://wordpress.org/extend/plugins/search.php?q=php+in+post+page&sort=](http://wordpress.org/extend/plugins/search.php?q=php+in+post+page&sort=)
 *  Thread Starter [barbaricht](https://wordpress.org/support/users/barbaricht/)
 * (@barbaricht)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/how-do-stop-visual-editor-from-striping-or-changing-php-code/#post-3245694)
 * Dear James,
 * Thank you for your response. My goal was not hardcode absolute URL’s for image
   tags. As a result, I added image tags in this way below using the HTML editor:
   
   <img src=”<?php echo site_url(); ?>/wp-content/uploads/2012/11/newsletter.png”/
   >
 * I did this because i will be uploading a local/development wordpress website 
   to production on the Interent using a different domain name.
 * This method worked fine, until i switch to the visual editor, which change the
   php code as described in the above posts.
 * And yes i’m using a plugin that allow me to add php code in the HTML editor. 
   The name of plug-in is “PHP Code for posts”.
 * thank you!
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/how-do-stop-visual-editor-from-striping-or-changing-php-code/#post-3245758)
 * A few random thoughts for possible workarounds…
    1. Will the php code plugin 
   still work if you used `<` and `>` to denote code blocks? 2. Consider creating
   a shortcode to insert the site url. 3. Develop the discipline to only work in
   html. Use the post preview feature to view the results.
 * Cheers!
 *  Thread Starter [barbaricht](https://wordpress.org/support/users/barbaricht/)
 * (@barbaricht)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/how-do-stop-visual-editor-from-striping-or-changing-php-code/#post-3245762)
 * Dear bcworkz,
 * thank you for you comments! To answer your questions starting with the first:
   the php code won’t work with code blocks. The visual editor still changes < >
   to character entities even though they are wrapped in code blocks.
 * The short code idea i like. I don’t know anything about short code because i 
   just starting learning wordpress a month ago. So i take a look at it.
 * lastly, i’m a web developer by profession and i use many programming languages.
   I could never only use html.
 * -tony

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

The topic ‘how do you stop visual editor from striping or changing ">" php code’
is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 3 participants
 * Last reply from: [barbaricht](https://wordpress.org/support/users/barbaricht/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/how-do-stop-visual-editor-from-striping-or-changing-php-code/#post-3245762)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
