我在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
多亏了@TomJ 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