Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress图像预览在Wordpress中工作不正常_Wordpress - Fatal编程技术网

Wordpress图像预览在Wordpress中工作不正常

Wordpress图像预览在Wordpress中工作不正常,wordpress,Wordpress,我上传了一些图片文件到上传文件夹,并设置了帖子的特色图片。但是当我以管理员身份登录并编辑特色图片时,媒体窗口只显示一个图标,没有显示预览。最后我得到了答案 require_once(ABSPATH . "wp-admin" . '/includes/image.php'); $attach_id = wp_insert_attachment( $attachment, $file_path, '' ); $attach_data = wp_generate_attachment_metadata

我上传了一些图片文件到上传文件夹,并设置了帖子的特色图片。但是当我以管理员身份登录并编辑特色图片时,媒体窗口只显示一个图标,没有显示预览。最后我得到了答案

require_once(ABSPATH . "wp-admin" . '/includes/image.php');
$attach_id = wp_insert_attachment( $attachment, $file_path, '' );
$attach_data = wp_generate_attachment_metadata( $attach_id, $file_path );
wp_update_attachment_metadata( $attach_id, $attach_data );
$imageid = set_post_thumbnail( $post_id, $attach_id );
add_post_meta($post_id , '_thumbnail_id', $attach_id);

检查WordPress文件权限

我更改为基本主题,停用了所有插件。文件权限更改为644。但没有发生任何变化