注意:正在尝试获取非对象的属性‘Term_id’

时间:2020-03-26 作者:Faruk rıza

我在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

1 个回复
最合适的回答,由SO网友:Faruk rıza 整理而成

我从数据库中的wpgy\\U术语中删除了有问题的条目,现在就可以了。如果您是数据库新手,我建议您先备份数据库,然后再对其进行操作。

相关推荐

在unctions.php文件中获取每个帖子的帖子术语‘wp_get_POST_Terms’

我使用了一个带有Ajax操作的表单来在提交时获取帖子信息。它很有魅力。然而,我使用了类别来将工作划分为不同的类别。其中之一就是品牌。在页面模板中,我使用的脚本有效,但在函数中使用时有效。php文件。它无法获得所需的结果。我认为这可能与何时触发对帖子的查询或如何设置add\\u操作有关。有人能帮我查一下ID为31的类别的名称吗?在函数中使用时。php。以下是我写的:if( $query->have_posts() ) : while( $query->have_posts() )