admin管理员组

文章数量:1122832

I have a custom post type called gr-item created by a Wordpress theme. However, checkboxes in Title column for custom post type posts on post list are disabled.

How can I enable them?

Any quick advice is very appreciated.

Regards

No Checkboxes before each Title of custom post type post. Please see the link below:

I have a custom post type called gr-item created by a Wordpress theme. However, checkboxes in Title column for custom post type posts on post list are disabled.

How can I enable them?

Any quick advice is very appreciated.

Regards

No Checkboxes before each Title of custom post type post. Please see the link below:

https://imgur.com/a/QOa1CWh

Share Improve this question edited Dec 21, 2023 at 4:22 daro2013 asked Dec 20, 2023 at 4:47 daro2013daro2013 251 silver badge6 bronze badges 2
  • Are you talking about the checkboxes in the admin used for bulk actions? Or something different on the front end? – Jacob Peattie Commented Dec 20, 2023 at 16:58
  • Hi Jacob Peattie Yes, checkboxes in Title column for custom post type posts on post list page at Admin backend. my question has been updated. – daro2013 Commented Dec 20, 2023 at 22:59
Add a comment  | 

2 Answers 2

Reset to default 1

I see on the link that several columns were added. I would recommend to check the function which was mentioned in the following call:

add_filter( 'manage_gr-item_columns', 'the_function' );

It seems someone removed the column 'cb' in the body of that function;

To enable checkboxes for custom post type posts on their post list in WordPress, you can achieve this by adding some code to your theme's functions.php file or by creating a custom plugin. Here's how to do it:

  1. Open your theme's functions.php file or create a custom plugin.

  2. Add the following code to enable checkboxes for your custom post type (replace 'gr-item' with your actual custom post type name if different):

function enable_custom_post_type_checkboxes($post_type) {
    if ($post_type === 'gr-item') {
        return 'page';
    }
    return $post_type;
}
add_filter('manage_posts_columns', 'enable_custom_post_type_checkboxes');
add_filter('manage_pages_columns', 'enable_custom_post_type_checkboxes');

This code filters the column list for both posts and pages and enables checkboxes for the 'gr-item' custom post type.

  1. Save the changes to your functions.php file or activate your custom plugin.

Now, when you go to the post list in your WordPress dashboard for your custom post type 'gr-item', you should see checkboxes next to each post title, allowing you to perform bulk actions and interact with the posts.

However, it's worth mentioning that there may be specific code in your third-party theme that is preventing the checkboxes from displaying, so the only way to know if this will work is to try it out. Best of luck to you!

本文标签: How can I enable checkboxes for custom post type posts on their post listWordpress