Hallo,
wenn ich versuche eine Produktart (Taxonomie) anzulegen, wird diese zwar wirklich erstellt. Allerdings finden sich in der Tabelle welche diese auflistet im ersten Moment nachfolgende Fehlermeldungen, welche ich nicht zu deuten lösen weiß.
Bei einem normalen Aufruf der Produktart-Verwaltung, sieht die Liste dann wieder Fehlerfrei aus. Heißt, keine Fehlermeldungen und auch sieht man das die gewünschte Produktart doch erfolgreich angelegt wurde.
Allerdings werden diese Hinweis-Meldungen sicher nicht ohne Grund generiert, weshalb ich um Rat bitten möchte um zu verstehen, wodurch diese generiert werden.
[size=12]Nachfolgend also die Hinweis-Meldungen[/SIZE]
ZitatNotice: Trying to get property of non-object in /wp-includes/link-template.php on line 898
Code Alles anzeigenfunction get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { $tax = get_taxonomy( $taxonomy ); [B][COLOR="#000080"] if ( !current_user_can( $tax->cap->edit_terms ) )[/color][/B] return; $term = get_term( $term_id, $taxonomy ); $args = array( 'action' => 'edit', 'taxonomy' => $taxonomy, 'tag_ID' => $term->term_id, ); if ( $object_type ) $args['post_type'] = $object_type; $location = add_query_arg( $args, admin_url( 'edit-tags.php' ) ); /** * Filter the edit link for a term. * * @since 3.1.0 * * @param string $location The edit link. * @param int $term_id Term ID. * @param string $taxonomy Taxonomy name. * @param string $object_type The object type (eg. the post type). */ return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type ); }
ZitatNotice: Trying to get property of non-object in /wp-admin/includes/class-wp-terms-list-table.php on line 290
Code Alles anzeigenpublic function column_cb( $tag ) { $default_term = get_option( 'default_' . $this->screen->taxonomy ); [B][COLOR="#000080"]if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) && $tag->term_id != $default_term )[/color][/B] return '<label class="screen-reader-text" for="cb-select-' . $tag->term_id . '">' . sprintf( __( 'Select %s' ), $tag->name ) . '</label>' . '<input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" id="cb-select-' . $tag->term_id . '" />'; return ' '; }
ZitatNotice: Trying to get property of non-object in /wp-admin/includes/class-wp-terms-list-table.php on line 330
Notice: Trying to get property of non-object in /wp-admin/includes/class-wp-terms-list-table.php on line 334
Notice: Trying to get property of non-object in /wp-admin/includes/class-wp-terms-list-table.php on line 336Code Alles anzeigen/** * Filter display of the term name in the terms list table. * * The default output may include padding due to the term's * current level in the term hierarchy. * * @since 2.5.0 * * @see WP_Terms_List_Table::column_name() * * @param string $pad_tag_name The term name, padded if not top-level. * @param object $tag Term object. */ $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; $actions = array(); [B][COLOR="#000080"]if ( current_user_can( $tax->cap->edit_terms ) ) {[/color][/B] $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; } [B][COLOR="#000080"]if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) [/color][/B] $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>"; [B][COLOR="#000080"]if ( $tax->public )[/color][/B] $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
ZitatNotice: Undefined property: WP_Error::$term_id in /wp-includes/class-wp-error.php on line 78
Notice: Undefined property: WP_Error::$name in /wp-includes/class-wp-error.php on line 78
Notice: Undefined property: WP_Error::$parent in /wp-includes/class-wp-error.php on line 78
Was mir dabei sofort ins Auge sticht ist die current_user_can()-Funktion. Allerdings verstehe ich nicht, wieso nun dieser eher standarisierte Taxonomie plötzlich besondere Rechte erfordern sollte. Bisherige Taxonomies brauchten diese auch nicht.
Aber auch mit dem Versuch ihm über Capabilites die erforderlichen manage-category Rechte zu gewähren, brachte keine Lösung des Problems.
Die Zeilen aus der functions.php meines Themes um den Taxonomie zu registrieren sehen dabei wie folgt aus:
(selbstverständlich ein wenig gesäubert, allerdings auch in dieser Form mit dem gleichen Fehler)
// Wordpress - Register Custom-Post-Type für Produkte und Produktarten
function product_post_type() {
$labels = array(
'name' => _x( 'Produkte', 'Post Type General Name', 'custom_text' ),
'singular_name' => _x( 'Produkt', 'Post Type Singular Name', 'custom_text' ),
'menu_name' => __( 'Produkte', 'custom_text' ),
);
$args = array(
[del] 'label' => __( 'product', 'custom_text' ),[/del]
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments' ),
'taxonomies' => array( 'productCat', 'productTag' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-media-spreadsheet',
[del] 'can_export' => true,[/del]
'has_archive' => true,
[del] 'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',[/del]
);
// Categorys
$catlabels = array(
'name' => _x( 'Produktarten', 'Taxonomy General Name', 'custom_text' ),
'singular_name' => _x( 'Produktart', 'Taxonomy Singular Name', 'custom_text' ),
'menu_name' => __( 'Produktarten', 'custom_text' ),
);
$catargs = array(
'labels' => $catlabels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
);
register_taxonomy( 'productCat', array( 'product' ), $catargs );
register_post_type( 'product', $args );
}
// Hook 'init' action
add_action( 'init', 'product_post_type', 0 );
Alles anzeigen
[size=10]Durchgestrichene Zeilen: Wurden bereits einmal probeweise entfernt, ohne Besserung.[/SIZE]
Also was haben wir...
- der Taxonomie ist registriert!
- Wird auch erstellt, wenn auch mit...
- ... einigen häßlichen Hinweis-Meldungen in der Tabellen-Liste.
Ich würde ungern die Hinweise ausblenden, da ich gern den Grund für diesen Fehler verstehen möchte um in Zukunft diesen natürlich zu vermeiden.
Hoffe wer weiß Rat.
Gruß,
Sascha