Make WordPress Core

Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#49962 closed enhancement (maybelater)

Remove hardcoded strong definition from title (admin) column

Reported by: beee's profile Beee Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords: 2nd-opinion
Focuses: ui, css, administration Cc:


Reason for ticket
In wp-admin/includes/class-wp-posts-list-table.php on line 1013 and 1039 there are 2 hardcoded strong definitions.

What happened?
When I decided to change the default column with the filter list_table_primary_column, I noticed the title was still bolded, which I didn't want.


When I looked at the source code I saw a hardcoded definition, hence why I made a dynamic suggestion to fix this.

  • remove strong on line 1013
  • remove /strong on line 1039
  • add on line 1018
$column       = apply_filters( 'list_table_primary_column', WP_List_Table::get_default_primary_column_name(), $this->screen->id );
$bolded_class = ( 'title' === $column ) ? 'bolded-class' : false;
  • change printf statement to
    	'<a class="row-title%s" href="%s" aria-label="%s">%s%s</a>',
    	get_edit_post_link( $post->ID ),
    	/* translators: %s: Post title. */
    	esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $title ) ),
  • add after $label, originally on line 1201
    $default_column = WP_List_Table::get_default_primary_column_name();
    $bolded_class   = ( $column_name === $default_column ) ? 'bolded-class' : false;
  • change $term_links, originally on line 1203
    $term_links[]   = $this->get_edit_link( $posts_in_term_qv, $label );
  • To
    $term_links[]   = $this->get_edit_link( $posts_in_term_qv, $label, $bolded_class );
  • add to css (don’t know which file)
    .bolded-class {
        font-weight: strong;

Any feedback is welcome.

Something similar is happening on

  • line 420 in class-wp-terms-list-table.php
  • line 192 in class-wp-links-list-table.php

but I didn't look into that yet.

Change History (3)

This ticket was mentioned in PR #245 on WordPress/wordpress-develop by Beee4life.

4 years ago

There is a hardcoded strong definition to 'bold' the title column in posts list table.

If you use the filter to define another column as default, the bolding stays on the title, why that might not be what you want (like in my case).

With my change the hardcoded strong definition is removed from the title column and dynamically added.

Trac ticket:

#2 @Beee
2 years ago

  • Resolution set to maybelater
  • Status changed from new to closed

#3 @SergeyBiryukov
2 years ago

  • Focuses ui added
  • Milestone Awaiting Review deleted

Hi there, welcome back to WordPress Trac!

Thanks for the ticket, sorry it took so long for someone to get back to you.

I think the idea of removing the hardcoded <strong> tag and making it respect the list_table_primary_column filter is worth exploring, though it should ideally be implemented across all list tables for consistency.

Feel free to reopen if there is still interest in working on this further.

Note: See TracTickets for help on using tickets.