2016-12-17 13 views
2

このエラーで私を助けてください。私は、私はワードプレスのサイトをコーディングする新しい持っていますし、それが次のエラー警告:不正な文字列オフセット 'custom_css_post_id'

警告を示しています/ホーム/コンテンツ/ n3pnexwpnas02_data02/3031418分の18/HTML/WP-含ま/テーマで不正な文字列オフセット「custom_css_post_id」を.php on line 905

どこから始めましょうか。私は昼寝以来誰かが私を助けることができますか?

ここ

はそれがtheme.php

function wp_get_custom_css_post($stylesheet = '') { 
if (empty($stylesheet)) { 
    $stylesheet = get_stylesheet(); 
} 

$custom_css_query_vars = array(
    'post_type'    => 'custom_css', 
    'post_status'   => get_post_stati(), 
    'name'     => sanitize_title($stylesheet), 
    'posts_per_page'   => 1, 
    'no_found_rows'   => true, 
    'cache_results'   => true, 
    'update_post_meta_cache' => false, 
    'update_term_meta_cache' => false, 
); 

$post = null; 
if (get_stylesheet() === $stylesheet) { 
    $post_id = get_theme_mod('custom_css_post_id'); 

    if ($post_id > 0 && get_post($post_id)) { 
     $post = get_post($post_id); 
    } else { 
     $query = new WP_Query($custom_css_query_vars); 
     $post = $query->post; 
     /* 
     * Cache the lookup. See WP_Customize_Custom_CSS_Setting::update(). 
     * @todo This should get cleared if a custom_css post is added/removed. 
     */ 
     if ($post) { 
      set_theme_mod('custom_css_post_id', $post->ID); 
     } elseif (-1 !== $post_id) { 
      set_theme_mod('custom_css_post_id', -1); 
     } 
    } 
} else { 
    $query = new WP_Query($custom_css_query_vars); 
    $post = $query->post; 
} 

return $post; 

}

+0

後のコードの下にこれを置きますか?あなたがそれを受け取ったときに何をしようとしていますか? – Daniel

+0

これは、連想配列を使用するはずの文字列を使用したことを意味します。 – Barmar

+0

ページの上部にエラーが表示され、私のサイトのメインナビゲーションメニューが乱れています。どこにコードを見つけるために行905を見つけるべきですか? –

答えて

0

に、私は同じ問題を抱えていて、このリンク上で何かを見つけ指すコードです:

https://wordpress.org/support/topic/illegal-string-offset-warning-4/

私はこれから何も得ていない。あなたはこれから何かを嫌うかもしれないかもしれません。

あなたが何か有用なものを見つけたら返信してください。 :)

ありがとうございました。

最近、多くのウェブサイトに表示されている不必要なWordPressの警告のように見えます。

私はプロダクションサーバーでこれらの問題を示すWordPressを停止するためにトリックを使用しました。

しかし、このトリックを開発サーバーで削除することはできます。見て:

はちょうど

エラーが出たん
define('WP_DEBUG', false); 
のwp-config.phpの中

ini_set('log_errors','On'); 
ini_set('display_errors','Off'); 
ini_set('error_reporting', E_ALL); 
define('WP_DEBUG', false); 
define('WP_DEBUG_LOG', true); 
define('WP_DEBUG_DISPLAY', false); 
関連する問題