Making WordPress.org

Changeset 12550


Ignore:
Timestamp:
04/20/2023 08:26:26 PM (2 years ago)
Author:
coffee2code
Message:

Photo Directory, Admin: Remove 'Orientations' column from photo post listings.

Photo orientation is not significant enough to warrant inclusion in the listing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/admin.php

    r12201 r12550  
    3535        add_action( 'admin_notices',                           [ __CLASS__, 'add_notice_to_photo_media_if_pending' ] );
    3636        add_filter( 'add_menu_classes',                        [ __CLASS__, 'add_admin_menu_pending_indicator' ] );
     37        add_filter( "manage_taxonomies_for_{$post_type}_columns", [ __CLASS__, 'remove_orientations_column' ], 10, 2 );
    3738
    3839        // Record and display photo contributor IP address.
     
    10531054    }
    10541055
     1056    /**
     1057     * Removes the 'Orientations' column from post listings.
     1058     *
     1059     * The column doesn't represent information that needs to be gleaned from a
     1060     * post listing overview.
     1061     *
     1062     * @param string[] $taxonomies Array of taxonomy names to show columns for.
     1063     * @param string   $post_type  The post type.
     1064     * @return string[]
     1065     */
     1066    public static function remove_orientations_column( $taxonomies, $post_type ) {
     1067        if ( Registrations::get_post_type() === $post_type ) {
     1068            unset( $taxonomies[ Registrations::get_taxonomy( 'orientations' ) ] );
     1069        }
     1070
     1071        return $taxonomies;
     1072    }
     1073
    10551074}
    10561075
Note: See TracChangeset for help on using the changeset viewer.