summaryrefslogtreecommitdiffstats
path: root/wp-includes/taxonomy.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:26 +0000
commit30883c26bdceb9eaf32c8d4a1b0c1bce223b5226 (patch)
tree39a02e2aeb21ab5b7923c6f5757d66d55b708912 /wp-includes/taxonomy.php
parentAdding upstream version 6.4.3+dfsg1. (diff)
downloadwordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.tar.xz
wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.zip
Adding upstream version 6.5+dfsg1.upstream/6.5+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/taxonomy.php')
-rw-r--r--wp-includes/taxonomy.php31
1 files changed, 27 insertions, 4 deletions
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index 59ec534..85ca5c3 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -231,8 +231,25 @@ function create_initial_taxonomies() {
'publicly_queryable' => false,
'hierarchical' => false,
'labels' => array(
- 'name' => _x( 'Pattern Categories', 'taxonomy general name' ),
- 'singular_name' => _x( 'Pattern Category', 'taxonomy singular name' ),
+ 'name' => _x( 'Pattern Categories', 'taxonomy general name' ),
+ 'singular_name' => _x( 'Pattern Category', 'taxonomy singular name' ),
+ 'add_new_item' => __( 'Add New Category' ),
+ 'add_or_remove_items' => __( 'Add or remove pattern categories' ),
+ 'back_to_items' => __( '&larr; Go to Pattern Categories' ),
+ 'choose_from_most_used' => __( 'Choose from the most used pattern categories' ),
+ 'edit_item' => __( 'Edit Pattern Category' ),
+ 'item_link' => __( 'Pattern Category Link' ),
+ 'item_link_description' => __( 'A link to a pattern category.' ),
+ 'items_list' => __( 'Pattern Categories list' ),
+ 'items_list_navigation' => __( 'Pattern Categories list navigation' ),
+ 'new_item_name' => __( 'New Pattern Category Name' ),
+ 'no_terms' => __( 'No pattern categories' ),
+ 'not_found' => __( 'No pattern categories found.' ),
+ 'popular_items' => __( 'Popular Pattern Categories' ),
+ 'search_items' => __( 'Search Pattern Categories' ),
+ 'separate_items_with_commas' => __( 'Separate pattern categories with commas' ),
+ 'update_item' => __( 'Update Pattern Category' ),
+ 'view_item' => __( 'View Pattern Category' ),
),
'query_var' => false,
'rewrite' => false,
@@ -241,6 +258,7 @@ function create_initial_taxonomies() {
'show_in_nav_menus' => false,
'show_in_rest' => true,
'show_admin_column' => true,
+ 'show_tagcloud' => false,
)
);
}
@@ -254,7 +272,7 @@ function create_initial_taxonomies() {
*
* @param array $args Optional. An array of `key => value` arguments to match against the taxonomy objects.
* Default empty array.
- * @param string $output Optional. The type of output to return in the array. Accepts either taxonomy 'names'
+ * @param string $output Optional. The type of output to return in the array. Either 'names'
* or 'objects'. Default 'names'.
* @param string $operator Optional. The logical operation to perform. Accepts 'and' or 'or'. 'or' means only
* one element from the array needs to match; 'and' means all elements must match.
@@ -2434,6 +2452,11 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
$description = wp_unslash( $args['description'] );
$parent = (int) $args['parent'];
+ // Sanitization could clean the name to an empty string that must be checked again.
+ if ( '' === $name ) {
+ return new WP_Error( 'invalid_term_name', __( 'Invalid term name.' ) );
+ }
+
$slug_provided = ! empty( $args['slug'] );
if ( ! $slug_provided ) {
$slug = sanitize_title( $name );
@@ -2573,7 +2596,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
$tt_id = (int) $wpdb->insert_id;
/*
- * Sanity check: if we just created a term with the same parent + taxonomy + slug but a higher term_id than
+ * Confidence check: if we just created a term with the same parent + taxonomy + slug but a higher term_id than
* an existing term, then we have unwittingly created a duplicate term. Delete the dupe, and use the term_id
* and term_taxonomy_id of the older term instead. Then return out of the function so that the "create" hooks
* are not fired.