18
18
wp_die( __( 'Invalid taxonomy' ) );
20
if ( ! current_user_can( $tax->cap->manage_terms ) )
21
wp_die( __( 'Cheatin’ uh?' ), 403 );
20
if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) {
21
wp_die( __( 'You are not allowed to manage these items.' ) );
24
if ( ! current_user_can( $tax->cap->manage_terms ) ) {
26
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
27
'<p>' . __( 'You are not allowed to manage these items.' ) . '</p>',
24
33
* $post_type is set when the WP_Terms_List_Table instance is created
46
55
add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) );
57
get_current_screen()->set_screen_reader_content( array(
58
'heading_pagination' => $tax->labels->items_list_navigation,
59
'heading_list' => $tax->labels->items_list,
63
$referer = wp_get_referer();
50
65
switch ( $wp_list_table->current_action() ) {
54
69
check_admin_referer( 'add-tag', '_wpnonce_add-tag' );
56
if ( !current_user_can( $tax->cap->edit_terms ) )
57
wp_die( __( 'Cheatin’ uh?' ), 403 );
71
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
73
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
74
'<p>' . __( 'You are not allowed to add this item.' ) . '</p>',
59
79
$ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
60
80
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
61
81
if ( 'post' != $post_type )
62
82
$location .= '&post_type=' . $post_type;
64
if ( $referer = wp_get_original_referer() ) {
65
if ( false !== strpos( $referer, 'edit-tags.php' ) )
84
if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) {
69
88
if ( $ret && !is_wp_error( $ret ) )
77
96
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
78
97
if ( 'post' != $post_type )
79
98
$location .= '&post_type=' . $post_type;
80
if ( $referer = wp_get_referer() ) {
81
if ( false !== strpos( $referer, 'edit-tags.php' ) )
100
if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) {
101
$location = $referer;
85
104
if ( ! isset( $_REQUEST['tag_ID'] ) ) {
89
108
$tag_ID = (int) $_REQUEST['tag_ID'];
90
109
check_admin_referer( 'delete-tag_' . $tag_ID );
92
if ( !current_user_can( $tax->cap->delete_terms ) )
93
wp_die( __( 'Cheatin’ uh?' ), 403 );
111
if ( ! current_user_can( $tax->cap->delete_terms ) ) {
113
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
114
'<p>' . __( 'You are not allowed to delete this item.' ) . '</p>',
95
119
wp_delete_term( $tag_ID, $taxonomy );
101
125
case 'bulk-delete':
102
126
check_admin_referer( 'bulk-tags' );
104
if ( !current_user_can( $tax->cap->delete_terms ) )
105
wp_die( __( 'Cheatin’ uh?' ), 403 );
128
if ( ! current_user_can( $tax->cap->delete_terms ) ) {
130
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
131
'<p>' . __( 'You are not allowed to delete these items.' ) . '</p>',
107
136
$tags = (array) $_REQUEST['delete_tags'];
108
137
foreach ( $tags as $tag_ID ) {
112
141
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
113
142
if ( 'post' != $post_type )
114
143
$location .= '&post_type=' . $post_type;
115
if ( $referer = wp_get_referer() ) {
116
if ( false !== strpos( $referer, 'edit-tags.php' ) )
117
$location = $referer;
144
if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) {
145
$location = $referer;
120
148
$location = add_query_arg( 'message', 6, $location );
139
167
$tag_ID = (int) $_POST['tag_ID'];
140
168
check_admin_referer( 'update-tag_' . $tag_ID );
142
if ( !current_user_can( $tax->cap->edit_terms ) )
143
wp_die( __( 'Cheatin’ uh?' ), 403 );
170
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
172
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
173
'<p>' . __( 'You are not allowed to edit this item.' ) . '</p>',
145
178
$tag = get_term( $tag_ID, $taxonomy );
152
185
if ( 'post' != $post_type )
153
186
$location .= '&post_type=' . $post_type;
155
if ( $referer = wp_get_original_referer() ) {
156
if ( false !== strpos( $referer, 'edit-tags.php' ) )
157
$location = $referer;
188
if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) {
189
$location = $referer;
160
192
if ( $ret && !is_wp_error( $ret ) )
215
247
$help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>';
217
249
$help .= '<ul>' .
218
'<li>' . __( '<strong>Name</strong> - The name is how it appears on your site.' ) . '</li>';
250
'<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>';
220
252
if ( ! global_terms_enabled() )
221
$help .= '<li>' . __( '<strong>Slug</strong> - The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>';
253
$help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>';
223
255
if ( 'category' == $taxonomy )
224
$help .= '<li>' . __( '<strong>Parent</strong> - Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>';
256
$help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>';
226
$help .= '<li>' . __( '<strong>Description</strong> - The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
258
$help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
228
260
'<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>';
253
285
require_once( ABSPATH . 'wp-admin/admin-header.php' );
255
if ( !current_user_can($tax->cap->edit_terms) )
256
wp_die( __('You are not allowed to edit this item.') );
259
$messages['_item'] = array(
260
0 => '', // Unused. Messages start at index 1.
261
1 => __( 'Item added.' ),
262
2 => __( 'Item deleted.' ),
263
3 => __( 'Item updated.' ),
264
4 => __( 'Item not added.' ),
265
5 => __( 'Item not updated.' ),
266
6 => __( 'Items deleted.' )
268
$messages['category'] = array(
269
0 => '', // Unused. Messages start at index 1.
270
1 => __( 'Category added.' ),
271
2 => __( 'Category deleted.' ),
272
3 => __( 'Category updated.' ),
273
4 => __( 'Category not added.' ),
274
5 => __( 'Category not updated.' ),
275
6 => __( 'Categories deleted.' )
277
$messages['post_tag'] = array(
278
0 => '', // Unused. Messages start at index 1.
279
1 => __( 'Tag added.' ),
280
2 => __( 'Tag deleted.' ),
281
3 => __( 'Tag updated.' ),
282
4 => __( 'Tag not added.' ),
283
5 => __( 'Tag not updated.' ),
284
6 => __( 'Tags deleted.' )
288
* Filter the messages displayed when a tag is updated.
292
* @param array $messages The messages to be displayed.
294
$messages = apply_filters( 'term_updated_messages', $messages );
297
if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) {
298
if ( isset( $messages[ $taxonomy ][ $msg ] ) )
299
$message = $messages[ $taxonomy ][ $msg ];
300
elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) )
301
$message = $messages['_item'][ $msg ];
287
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
289
'<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' .
290
'<p>' . __( 'You are not allowed to edit this item.' ) . '</p>',
295
/** Also used by the Edit Tag form */
296
require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' );
304
298
$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
306
300
if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
349
343
<div class="form-wrap">
352
/** This filter is documented in wp-includes/category-template.php */
353
printf( __( '<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.' ), apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) );
346
echo '<strong>' . __( 'Note:' ) . '</strong><br />';
348
/* translators: %s: default category */
349
__( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ),
350
/** This filter is documented in wp-includes/category-template.php */
351
'<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) . '</strong>'
356
355
<?php if ( current_user_can( 'import' ) ) : ?>