最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - Notice: Trying to get property 'term_id' of non-object

programmeradmin2浏览0评论

I receive the error on taxonomy page in wp-admin.Before this error, I had problem that couldnt add the taxonomy to menu because of my taxonomy code.I fixed the code then the current error became.So, How to fix it? Thanks

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

Thanks to @Tom J Nowell or Captain one eye as popular name in this community, I fixed it.The answer so its the changing in code:

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

the taxonomy is Districts.

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

I receive the error on taxonomy page in wp-admin.Before this error, I had problem that couldnt add the taxonomy to menu because of my taxonomy code.I fixed the code then the current error became.So, How to fix it? Thanks

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

Thanks to @Tom J Nowell or Captain one eye as popular name in this community, I fixed it.The answer so its the changing in code:

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

the taxonomy is Districts.

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
Share Improve this question asked Mar 26, 2020 at 17:03 Faruk rızaFaruk rıza 982 silver badges11 bronze badges 2
  • This is probably related to terms in the database having District rather than district, you might need to recreate and reassign those terms, then delete the originals. Also my eyes work fine, I just pulled a funny face for my avatar – Tom J Nowell Commented Mar 26, 2020 at 17:24
  • @TomJNowell yes, I deleted some infos from wpgy_terms and it works now.Also I am happy for your eye's health – Faruk rıza Commented Mar 26, 2020 at 18:40
Add a comment  | 

1 Answer 1

Reset to default 0

I deleted problematic entries from wpgy_terms on database then it works now.If you are new at database, I suggest that backup your database before do something on it.

发布评论

评论列表(0)

  1. 暂无评论