johnbillion / extended-cpts

A library which provides extended functionality to WordPress custom post types and taxonomies.
GNU General Public License v2.0
979 stars 96 forks source link

Filter 'ext-cpts/{$post_type}/args' and 'admin_cols' #62

Closed Rayken closed 7 years ago

Rayken commented 7 years ago
add_filter( 'ext-cpts/my_cpt/args', function( $args ) {
    $args['admin_cols']['my_custom_col']['title'] = 'NOPE';

    return $args;
});

For whatever reason, 'admin_cols' is being ignored and the "original" set 'title' remains intact. I believe https://github.com/johnbillion/extended-cpts/blob/master/extended-cpts.php#L1580 might need some love, or $this->the_cols somehow needs to wp_parse_args() or somewhat somewhere.

johnbillion commented 7 years ago

Well spotted. This is indeed a bug.

The issue actually lies here: https://github.com/johnbillion/extended-cpts/blob/78aae31ac48ebb9213c42f6e3a5862d7575b942b/extended-cpts.php#L76

The original value of $args passed to the function is passed into the Extended_CPT_Admin class. Instead, $cpt->args should be passed in.