WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using TinyMCE Advanced and SyntaxHighliter plugins on my WordPress install.

Why does the editor change my inserted code, from:



<!--?php <br ?-->/**
share|improve this question
up vote 1 down vote accepted

I suggest you to use htmlspecialchars() before sending content andhtmlspecialchars_decode() before showing content on page, here is functions that you need to copy/paste to your functions.php :

function wp_po9568($content)
    return htmlspecialchars($content);


function wp_po5689($content)
    return htmlspecialchars_decode($content);
add_filter( 'the_content','wp_po5689');

Wordpress by default comments out php tags.

share|improve this answer
Thanks I'll try this out. – drtanz Mar 15 '13 at 15:35
This is so wrong. There is possibility that you dont want to convert everything. Adding a code to the_content is just wrong – Ünsal Korkmaz Mar 19 '13 at 20:58

You can use this filter on your theme functions.php

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 12);

This will remove extra P and line brake from short-code. More details will found here http://dynamicweblab.com/2012/10/removing-extra-p-and-line-breaks-from-shortcodes-in-wordpress/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.