去除擾人的自動轉換功能

Posted by: 邱小新 at 下午3:37:00 in

去除<br/>及<p></p>的自動轉換

1. 安裝 Text Control 插件。

2. 修改 wp-includes/js/tinymce/tiny_mce_config.php

// TinyMCE init settings $initArray = array ( 'mode' => 'none', 'onpageload' => 'wpEditorInit', 'width' => '100%',

修改成

// TinyMCE init settings $initArray = array ( 'forced_root_block' => false, 'force_br_newlines' => false, 'force_p_newlines' => false, 'mode' => 'none', 'onpageload' => 'wpEditorInit', 'width' => '100%',

去除 & 的自動轉換

2. 修改 wp-includes/formatting.php

第一個部份

$curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl); $output .= $curl; } return $output;

修改成

// $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl); $output .= $curl; } return $output;

第二個部份

// Remove metadata tags $content = preg_replace('/<title>(.+?)<\/title>/','',$content); $content = preg_replace('/<category>(.+?)<\/category>/','',$content); // Converts lone & characters into &#38; (a.k.a. &amp;) $content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content);

修改成

// Remove metadata tags $content = preg_replace('/<title>(.+?)<\/title>/','',$content); $content = preg_replace('/<category>(.+?)<\/category>/','',$content); // Converts lone & characters into &#38; (a.k.a. &amp;) // $content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content);

0 意見

張貼留言