Automattic / Automattic/custom-metadata

Hierarchical custom post types "display_column" not working.

Open
#58 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
190
Forks
46
Avg merge
46m
Merged PRs (30d)
15

Description

Hi,

I've had an issue with custom post type registered with hierarchical attribute to on. The display column content would not show up with those with this attribute set to true. Everything works fine if I set the attribute to false. I have been able to resolve the issue myself by modifying the following (in custom-metadata.php):

line 178
from : `$column_header_name = sprintf( '%_posts', $object_type );`
to : `$column_header_name = sprintf( '%s_posts', $object_type );`

line 198
from : `add_action( "manage_{$column_content_name}_custom_column", $custom_column_content_function, 10, 3 );`
to : `add_action( "manage_{$column_header_name}_custom_column", $custom_column_content_function, 10, 3 );`

line 200
from : `add_filter( "manage_{$column_content_name}_custom_column", $custom_column_content_function, 10, 3 );`
to : `add_filter( "manage_{$column_header_name}_custom_column", $custom_column_content_function, 10, 3 );`

Contributor guide

Open the contributing guide

Research direction

Start in custom-metadata.php around lines 178, 198, and 200, where the custom column name and hooks are built. Reproduce the issue with a hierarchical custom post type, then verify that the display column content appears while existing non-hierarchical custom post types continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.