| 
	之前为Wordpress域名购买ssl证书,使用https协议的时候 
	因为wp默认的绝对路径,导致引用不受信用脚本,https会有一些问题 
	就将绝对路径改为相对路径了 
	更改的方法非常简单 
	修改wp根目录下wp-includes/post.php中的wp_get_attachment_url函数 
	将代码替换为: 
	function wp_get_attachment_url( $post_id = 0 ) { 
	$file_dir=dirname(__FILE__); 
	$server_root=$_SERVER[DOCUMENT_ROOT]; 
	$file_dir=substr($file_dir,strlen($server_root)); 
	$file_dir=substr($file_dir,0,-12); 
	if($file_dir!=”){ 
	$file_dir=’/’.substr($file_dir,1); 
	} 
	$post_id = (int) $post_id; 
	if ( !$post =& get_post( $post_id ) ) 
	return false; 
	$url = ”; 
	if ( $file = get_post_meta( $post->ID, ‘_wp_attached_file’, true) ) { //获取附加文件 
	if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //获取上传路径 
	if ( 0 === strpos($file, $uploads['basedir']) ) //检查路径中是否存在文件 
	//$url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //更换文件的地址位置 
	$url=$file_dir.”/wp-content/uploads/”.$file; 
	elseif ( false !== strpos($file, ‘wp-content/uploads’) ) 
	//$url = $uploads['baseurl'] . substr( $file, strpos($file, ‘wp-content/uploads’) + 18 ); 
	$url=$file_dir.”/wp-content/uploads/”.$file; 
	else 
	//$url = $uploads['baseurl'] . “/$file”; //一个新上传的文件,$file相当于一个basedir 
	$url=$file_dir.”/wp-content/uploads/”.$file; 
	} 
	} 
	if ( empty($url) ) //如果以上的任何一个选项失败,回退GUID作为pre-2.7,不建议依赖 
	$url = get_the_guid( $post->ID ); 
	if ( ‘attachment’ != $post->post_type || empty($url) ) 
	return false; 
	return apply_filters( ‘wp_get_attachment_url’, $url, $post->ID ); 
	} 
	但是这样也有一定的问题 
	就是在生成了站点地图sitemap.xml,递交google webmaster时 
	google会因为相对路径而提示错误链接 
	屏幕截图 2015-11-12 10.38.08 
	最终没有办法..还是改回了绝对路径T_T(责任编辑:最模板) | 



 钻石珠宝商城源码整站|
							人气:1989
							钻石珠宝商城源码整站|
							人气:1989
						 ecshop仿趣玩网2014模板带团
							人气:519
							ecshop仿趣玩网2014模板带团
							人气:519
						 谷歌翻译仿panli代购程序
							人气:2319
							谷歌翻译仿panli代购程序
							人气:2319
						 ecshop仿Vjia商城2014网店模板
							人气:948
							ecshop仿Vjia商城2014网店模板
							人气:948
						 黑色苹果简洁风格|ecshop外
							人气:1458
							黑色苹果简洁风格|ecshop外
							人气:1458
						 ecshop仿烧包网模板|包包模
							人气:597
							ecshop仿烧包网模板|包包模
							人气:597