Search code examples
wordpresscustom-taxonomynotice

WordPress custom taxonomy page stdclass notice


I'm trying to add custom taxonomy to a custom post type in WordPress. When wp_debig is enabled the wp-admin page throws a notice:

Notice: Undefined property: stdClass::$taxonomy in /opt/lampp/htdocs/wordpress/wp-includes/admin-bar.php on line 503

in the line 503 there is only this:

 && ( $tax = get_taxonomy( $tag->taxonomy ) )

My custom taxonomy is like this:

    function create_project_types(){
        $labels = array(
            'name' => __('Project Type', 'abc'),
            'singular_name' => __('Project Type', 'abc'),
            'search_items' => __('Search Project Types', 'abc'),
            'all_items' => __('All Project Types', 'abc'),
            'edit_item' => __('Edit Project Type', 'abc'),
            'update_item' => __('Update Project Type', 'abc'),
            'add_new_item' => __('Add New Project Type', 'abc'),
            'new_item_name' => __('New Project Type', 'abc'),
            'separate_items_with_commas' => __('Separate Types with commas', 'abc'),
            'add_or_remove_items' => __('Add or Remove Project Type', 'abc'),
            'choose_from_most_used' => __('Choose from Most Used Project Types', 'abc')
        );
        $args = array(
            'label' => __('Project Type', 'abc'),
            'labels' => $labels,
            'public' => true,
            "hierarchical" => true,
            'show_ui' => true,
            'show_in_nav_menus' => true,
            'args' => array('orderby' => 'term_order'),
            'rewrite' => array('slug' => 'project-type','with_front' => true),
            'query_var' => true
        );
        register_taxonomy("project-type", 'project', $args);
    }
add_action('init', 'create_project_types', 0);

Everything is working properly I'm just trying to dismiss that notice. Can You help me?


Solution

  • I found my own answer. I overwited the global $tag variable, and this couse the notice.