2014-02-12 82 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

我的模板中的代碼存在問題(與未關閉的標籤有關),因此回溯我的代碼解決了問題。