What is the best way to customise admin files so they survive future upgrades?

I have a site with some custom post types, one of which doesn’t have a title.

When viewed in the admin section, the posts are listed like so

Read More

Which is less than ideal, for obvious reasons.

I have edited one of the admin files wp-admin/includes/class-wp-posts-list-table.php to display the list as below

The problem is the customisation is overwritten by upgrades.

What is the correct way to make customisations to the admin files so they survive upgrades?

Related posts

Leave a Reply

2 comments

  1. I’m assuming you are setting the Post Title via a Custom Field created for your Custom Post Type “reviews”.

    As a suggestion, would it not be easier to have WordPress set the value of the Post Title from the value in which you enter into your Custom Field instead of having to alter the columns of the post list?

    This would avoid that ugly scenario where you see Auto Draft and would make the Post Title available should you wish to call it using <?php the_title();?> in various places within your theme.

    In some instances for Custom Post Types, I have completely removed the Post Title field seen traditionally at the top of the edit screen. Instead I’ve replaced the usual fields seen with a Custom Metabox whereby one of the particular fields within this Metabox also sets the title of the post.

    Coincidentally one of the ways to achieve this has also been provided by Chip Bennett above in another question located here: Custom Post Type: Set post_title equal to a custom post type field

    Chip’s first answer above is entirely correct in terms of the context in which this question applies. I am just providing an alternate solution opposed to traveling down that particular route in the first place.

    Of course that method is perfectly usable in situations where you might want to display certain custom fields within the post columns that fall outside of the traditional, Title, Author, Date, etc already provided natively by WordPress.