WordPress图像路径/链接被更改或损坏

时间:2015-01-31 06:19:54

标签: wordpress image wordpress-theming filepath

这是代码当我通过"添加媒体"上传图像时按钮。

<p><a href="http://bebe15594.staging-cloud.partnerconsole.net/wp-content/uploads/Brains-like-a-pack-of-cards-Card-Placeholder.png"><img class="alignleft wp-image-197 size-full" src="http://bebe15594.staging-cloud.partnerconsole.net/wp-content/uploads/Brains-like-a-pack-of-cards-Card-Placeholder.png" alt="Brains like a pack of cards - Card Placeholder" width="470" height="663" /></a></p>

但是当我保存/更新上面的代码更改为

<p><a href="\&quot;http://bebe15594.staging-cloud.partnerconsole.net/wp-content/uploads/Brains-like-a-pack-of-cards-Card-Placeholder.png\&quot;"><img class="\&quot;alignleft" src="\&quot;http://bebe15594.staging-cloud.partnerconsole.net/wp-content/uploads/Brains-like-a-pack-of-cards-Card-Placeholder.png\&quot;" alt="\&quot;Brains" width="\&quot;470\&quot;" height="\&quot;663\&quot;" /></a></p>

有谁能告诉我它为什么这样做? 我该怎么做才能解决这个问题?

2 个答案:

答案 0 :(得分:0)

将此代码添加到functions.php文件中:

 function wpse72941_content_filter( $content ) {
   $new_content = '';
   foreach( preg_split( '/((\r?\n)|(\r\n?))/', $content ) as $line ) {
   $new_content .= preg_replace( '/^&gt;/', '>', $line ) . '\r\n';
   }
   return $new_content;
 }
 add_filter( 'the_content', 'wpse72941_content_filter', 1 );

答案 1 :(得分:0)

您没有指定代码行的位置,即自定义模板,正常添加帖子&#39;如果它是自定义模板,请在您自己编写脚本之前和wp_print_scripts('media-upload');之后添加wp_enque_script('jquery');。这是假设您使用wp_editor上传图像。