Title: php code is visible
Last modified: August 19, 2016

---

# php code is visible

 *  Resolved [netrover](https://wordpress.org/support/users/netrover/)
 * (@netrover)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/)
 * I need to add a page with php code on it. I switch to HTML mode and paste the
   php code, but WP strips the php tags, and I can see the code text on preview.
   How do I fix?

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

 *  [webjunk](https://wordpress.org/support/users/webjunk/)
 * (@webjunk)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092085)
 * Guessing you are doing it out of the box. You need to use the php exec plugin.
   You can find it:
    [http://wordpress.org/extend/plugins/exec-php/](http://wordpress.org/extend/plugins/exec-php/)
 * If you have other people posting be very very very careful who you allow to use
   it. Allowing php code is very dangerous.
 *  [f00bar](https://wordpress.org/support/users/f00bar/)
 * (@f00bar)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092103)
 * Pages and posts don’t support PHP code.
 * Try installing Exec-PHP: [http://wordpress.org/extend/plugins/exec-php/](http://wordpress.org/extend/plugins/exec-php/)
   this is a plugin which will allow you to do this.
 *  Thread Starter [netrover](https://wordpress.org/support/users/netrover/)
 * (@netrover)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092319)
 * Hi,
 * thanks for the plug-in reference. I installed it and activated it, but the problem
   persists– php tags disappear when I switch to view; i haven’t published it yet.
 * I’m a bit surprised that a plug-in is needed in order to run php on a WP page.
   How do affiliate marketers track their page hits and keywords?
 *  Thread Starter [netrover](https://wordpress.org/support/users/netrover/)
 * (@netrover)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092320)
 * I just published the page anyways, and I do not see the code anymore. I think
   it’s working; even thought preview mode shows the code.
 *  [f00bar](https://wordpress.org/support/users/f00bar/)
 * (@f00bar)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092343)
 * You can always edit the templates directly – they are all in PHP.
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092345)
 * If you want to show code on the page, as in display it for others to copy and
   paste (or just view) etc…
 * Code snippets, that kinda thing… try this..
    [http://wordpress.org/extend/plugins/syntaxhighlighter-plus/](http://wordpress.org/extend/plugins/syntaxhighlighter-plus/)
 *  [webjunk](https://wordpress.org/support/users/webjunk/)
 * (@webjunk)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092346)
 * I believe with the plugin you must disable the Visual editor. Don’t just Not 
   use the visual editor as it still can strip the code. You need to edit with the
   html editor. Should be documeneted somewhere. You can turn it back on when doing
   posts that don’t have php.
 *  Allowing PHP code natively in a CMS would be extremely dangerous. Especially
   since most allow other Users to create posts & Pages. Consider this if you allow
   User permissions within execphp.
    The issue is someone could post code to do 
   nearly anything including deletes with your database. Could even be made to transfer
   or change any file (non-WP) sitting on your hosting account. The PHP code would
   run from the server with full permissions. Had a client (not on WP) last year
   who had a site with a cron job running daily sending all files & databases which
   all originated from some php code that was allowed in a certain web app. In addition
   someone else setup their own website within his site. Be Very, very, careful….

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

The topic ‘php code is visible’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 4 participants
 * Last reply from: [webjunk](https://wordpress.org/support/users/webjunk/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/php-code-is-visible/#post-1092346)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
