2014-02-12 79 views
0

我想将图片添加到我的帖子,但我不断收到以下消息:“上传时发生错误,请稍后再试。”无法在wordpress中上传图片

请注意,我可以看到媒体库中的图像。

我在localhost上工作。

使用wordpress 3.8.1。

+0

我认为问题可能出在您上传图片时,您的评论可能会显示在来自导致错误显示的ajax的响应中。我已经通过相同的问题,并发现我的评论显示在响应中。当我删除它时,图像上传得很好。 –

回答

1

它可以是由于插件conflict.To检查其是否是真正的情况,通过导航到WordPress的管理仪表板停用所有插件>插件>选择所有插件>批量操作>禁用>转到

+0

感谢您的回复,但它不起作用。 – user1628778

+0

您是否安装过与媒体相关的插件? – mmounirf

+0

我安装了YARPP插件。 – user1628778

0

那么,在深入探讨问题后,如果设置了post_id值并且用户无权编辑带有该ID的帖子,则该过程似乎只会失败。

转到WP-包括/忽略原始

查找* wp_enqueue_media *功能 后来移到此块

$post = null; 
    if (isset($args['post'])) { 
     $post = get_post($args['post']); 
     $settings['post'] = array(
      'id' => $post->ID, 
      'nonce' => wp_create_nonce('update-post_' . $post->ID), 
     ); 

,并更改为

$post = null; 
    if (isset($args['post'])) { 
     $post = get_post($args['post']); 

     if (is_admin()) { 
      $settings['post'] = array(
       'id' => $post->ID, 
       'nonce' => wp_create_nonce('update-post_' . $post->ID), 
      ); 
     } 
+0

我试过了,但没有奏效。 – user1628778

0
If you have issues in finding: 

require_once(ABSPATH . 'wp-settings.php');” 
then find define('WP_DEBUG', false);and add the below given code before it: 

define(‘CONCATENATE_SCRIPTS’, false); 

enter image description here

+0

你确定这是我的问题的解决方案吗? – user1628778

0

我的模板中的代码存在问题(与未关闭的标签有关),因此回溯我的代码解决了问题。