I'm using TinyMCE Advanced and SyntaxHighliter plugins on my WordPress install.
Why does the editor change my inserted code, from:
[php]
<?php
/**
echo('code');
/**/
[/php]
to:
[php]
<!--?php <br ?-->/**
echo('code');
/**/
[/php]
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI 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);
}
add_filter('content_save_pre','wp_po9568');
And:
function wp_po5689($content)
{
return htmlspecialchars_decode($content);
}
add_filter( 'the_content','wp_po5689');
Wordpress by default comments out php tags.
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/