0

In my custom post type I unset the title column to add onclick event on each post title but it shift's the check boxes to next column, how can I have back check boxes to the title or if I want to hide completely how can I do that.

http://prntscr.com/gv5odl

First i remove all row actions

add_filter('post_row_actions', 'remove_row_actions', 10, 1);

function remove_row_actions($actions) {

    if (get_post_type() === 'tasks') {
        unset($actions['edit']);
        unset($actions['view']);
        unset($actions['trash']);
        unset($actions['inline hide-if-no-js']);
    }

    return $actions;

}

then I unset and re produce the title column

add_filter('manage_edit-tasks_columns', 'edit_first_column');

function edit_first_column($columns) {

    unset($columns['title']);

    $arr = array();

    foreach ($columns as $key => $value) {
        $arr['new_title'] = 'Title';
        $arr[$key] = $value;
    }

    return $arr;

}
0

look what is in $columns, you will see the column cb for "checkbox"

then you can do that :

function edit_first_column($columns) {

    $arr = [
        "cb" => $columns["cb"];
        "new_title" = "Title";
    ]


    unset($columns['cb']);
    unset($columns['title']);

    $arr += $columns;

    return $arr;

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.