tag from within the editor.
Note:
I've tested this on WordPress 2.0.4 and 2.0.1.
I have the rich text editor disabled and the option which has Wordpress auto-correct the syntax in your post.
Copyright (C) 2006 George A. Papayiannis
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The license is also available at http://www.gnu.org/copyleft/gpl.html
*/
add_filter('the_content','sem_fix_code','1');
function sem_fix_code($content) {
return preg_replace_callback('!]*)>(?:\r\n|\n|\r|)(.*?)(?:\r\n|\n|\r|)!ims', 'sem_fix_code_callback', $content);
}
function sem_fix_code_callback($matches) {
$escapedContent = $matches[2];
$escapedContent = str_replace("<","<",$escapedContent);
$result = "
";
$result = $result.$escapedContent."