Notice: Trying to get property ‘term_id’ of non-object
Question
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 James 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
0
notices, plugin-development, term-meta, terms, theme-development
3 years
2020-03-26T12:51:45-05:00
2020-03-26T12:51:45-05:00 0 Answers
181 views
0
Leave an answer