web-dev-qa-db-ja.com

注意:非オブジェクトのプロパティ 'term_id'を取得しようとしています

Wp-adminの分類法ページでエラーが表示されます。このエラーの前に、分類法コードのために分類法をメニューに追加できないという問題がありました。コードを修正すると、現在のエラーが発生しました。修正方法は?ありがとう

Notice: Trying to get property 'term_id' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 420

Notice: Trying to get property 'name' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 421

Notice: Trying to get property 'slug' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 424

Notice: Trying to get property 'parent' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 425
turkey

Notice: Trying to get property 'query_var' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-includes/taxonomy.php on line 4218


    Notice: Trying to get property 'term_id' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 420

    Notice: Trying to get property 'name' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 421

    Notice: Trying to get property 'slug' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 424

    Notice: Trying to get property 'parent' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-admin/includes/class-wp-terms-list-table.php on line 425
    turkey

    Notice: Trying to get property 'query_var' of non-object in /home/deniztas/oneclick.deniz-tasarim.site/wp-includes/taxonomy.php on line 4218

このコミュニティでの人気の名前として@Tom J NowellまたはCaptain one Eyeのおかげで、私はそれを修正しました。

I've identified two issues, the first, this:

            'rewrite' => true,
            'rewrite' => array( 'slug' => 'districts' ),
Can just be this:

            'rewrite' => array( 'slug' => 'districts' ),
And the second, the reason you get invalid menu items, is because districts is being used as the rewrite slug, but, the internal namevof

分類は地区です。

Replacing Districts with districts as the internal name fixed the issue for me locally:

register_taxonomy( 'districts', array('post'), array(
It's a general rule of thumb to keep internal names of things lower case, you can always use the labels for what the user sees
1
Faruk rıza

データベースのwpgy_termsから問題のあるエントリを削除しましたが、今は機能します。データベースが初めての場合は、何かを行う前にデータベースをバックアップすることをお勧めします。

0
Faruk rıza