- function __construct() {
- global $post_type, $taxonomy, $tax;
+ function __construct( $args = array() ) {
+ global $post_type, $taxonomy, $action, $tax;
- wp_reset_vars( array( 'action', 'taxonomy', 'post_type' ) );
+ parent::__construct( array(
+ 'plural' => 'tags',
+ 'singular' => 'tag',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+ ) );
+
+ $action = $this->screen->action;
+ $post_type = $this->screen->post_type;
+ $taxonomy = $this->screen->taxonomy;
- if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'public' => true ) ) ) )
+ // @todo Still needed? Maybe just the show_ui part.
+ if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) )
$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
$columns = array(
'cb' => '<input type="checkbox" />',
'name' => _x( 'Name', 'term name' ),
$columns = array(
'cb' => '<input type="checkbox" />',
'name' => _x( 'Name', 'term name' ),
- $default_term = get_option( 'default_' . $taxonomy );
+ if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) && $tag->term_id != $default_term )
+ 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 . '" />';
$default_term = get_option( 'default_' . $taxonomy );
$pad = str_repeat( '— ', max( 0, $this->level ) );
$name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
$default_term = get_option( 'default_' . $taxonomy );
$pad = str_repeat( '— ', max( 0, $this->level ) );
$name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
- $args['post_type'] = $post_type;
+ if ( 'post' != $this->screen->post_type )
+ $args['post_type'] = $this->screen->post_type;
+
+ if ( 'attachment' == $this->screen->post_type )
+ return "<a href='" . esc_url ( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
- $screen = get_current_screen();
-
- return apply_filters( "manage_{$screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
+ return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
- do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $tax->name );
+ do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
<?php $update_text = $tax->labels->update_item; ?>
<a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
<?php $update_text = $tax->labels->update_item; ?>
<a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
<span class="error" style="display:none;"></span>
<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
<span class="error" style="display:none;"></span>
<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>