Hi guys,
we’re developing a new wordpress theme; all’s ok, but when we try to add new term into our custom taxonomy we receive php notices like:
Notice: Trying to get property of non-object in /home/themelovin/dev/slurp/wp-admin/includes/class-wp-terms-list-table.php on line 235
or
Notice: Undefined property: WP_Error::$name in /home/themelovin/dev/slurp/wp-admin/includes/class-wp-terms-list-table.php on line 269
And so on…
We’re all going crazy
Someone can help us?
Pleeeeease
Themelovin
So, what’s on line 235 and 269…?
I’m assuming you’re trying to access the value with…
$something->name
…but instead you should be accessing it with…
$something['name']
Hi,
here’s the line 235:
if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) && $tag->term_id != $default_term )
and here’s line 269
$out .= ‘’ . $qe_data->name . ‘
’;
Thanks’ to everyone
Hi guys,
here’s our code to create custom post type “Portfolio”
function portfolio_register() {
$labels = array(
'name' => _x('Portfolio', 'post type general name', 'themelovin'),
'singular_name' => _x('Portfolio item', 'post type singular name', 'themelovin'),
'add_new' => _x('Add new', 'portfolio item', 'themelovin'),
'add_new_item' => __('Add new portfolio item', 'themelovin', 'themelovin'),
'edit_item' => __('Edit portfolio item', 'themelovin'),
'new_item' => __('New portfolio item', 'themelovin'),
'view_item' => __('View portfolio item', 'themelovin'),
'search_items' => __('Search portfolio', 'themelovin'),
'not_found' => __('Nothing found', 'themelovin'),
'not_found_in_trash' => __('Nothing found in trash', 'themelovin'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail', 'post-formats')
);
register_post_type( 'portfolio' , $args );
flush_rewrite_rules();
}
add_action(‘init’, ‘portfolio_register’);
register_taxonomy(“Skills”, array(“portfolio”), array(“hierarchical” => true, “label” => “Skills”, “singular_label” => “Skill”, “rewrite” => true));
Seems that wordpress has some problems creating new terms for portfolio post type
Thanks a lot
Themelovin
So, what was wrong?
Btw, you do not want to flush rewrite rules on every page load. I suggest you remove that piece of code.
pogoking said
So, what was wrong?
Btw, you do not want to flush rewrite rules on every page load. I suggest you remove that piece of code.
Good catch, i didn’t see it in the unformatted code.
flush_rewrite_rules should only be used on theme/plugin activation.
Hi guys,
I’ve no idea about the problem. I just write another time the code reported
Thanks about the advice regarding flush_rewrite_rules
Thanks you all
Themelovin