Show all post tags on post edit screen/sidebox

I’d say the easiest way to do it is use the get_terms_args filter and unset the number limit if the context is right (the AJAX request to get the tag cloud):

function wpse_64058_all_tags ( $args ) {
    if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) && $_POST['action'] === 'get-tagcloud' )
        unset( $args['number'] );
    return $args;
}

add_filter( 'get_terms_args', 'wpse_64058_all_tags' );

Note: In the edit box the link will still read “Choose from the most used tags”, even though we’re now displaying all of them.

Edit: As @bonger suggested, you could determine the post type from the referer:

if ( $qs = parse_url( wp_get_referer(), PHP_URL_QUERY ) ) {
    parse_str( $qs, $args );

    if ( ! empty( $args['post_type'] ) )
        $post_type = $args['post_type'];
    elseif ( ! empty( $args['post'] ) )
        $post_type = get_post_type( $args['post'] );
    else
        $post_type="post";
}

Leave a Comment