Make WordPress Core

Ticket #18722: 18722.no-global.1.diff

File 18722.no-global.1.diff, 1.2 KB (added by coffee2code, 13 years ago)

Example of making potentially restrictive if() fully permissive

  • wp-admin/includes/class-wp-terms-list-table.php

     
    283283        }
    284284
    285285        function column_posts( $tag ) {
    286                 global $taxonomy, $post_type;
     286                global $taxonomy;
    287287
    288288                $count = number_format_i18n( $tag->count );
    289289
    290290                $tax = get_taxonomy( $taxonomy );
    291291
     292                $post_type = get_current_screen()->post_type;
    292293                $ptype_object = get_post_type_object( $post_type );
     294
    293295                if ( ! $ptype_object->show_ui )
    294296                        return $count;
    295297
  • wp-admin/includes/screen.php

     
    446446                $base = $id;
    447447
    448448                // If this is the current screen, see if we can be more accurate for post types and taxonomies.
    449                 if ( ! $hook_name ) {
     449                if ( true ) {
    450450                        if ( isset( $_REQUEST['post_type'] ) )
    451451                                $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false;
    452452                        if ( isset( $_REQUEST['taxonomy'] ) )