Why not get all post_types and loop through them with the filter. This should work if the callback for all post types is the same (managesortablecolumns).
The code will look something like this:
function init_managesortablecolumns (){
$post_types = get_post_types();
foreach( $post_types as $post_type ){
add_filter( 'manage_edit-' . $post_type . '_sortable_columns', 'managesortablecolumns' );
}
}
add_action( 'init', 'init_managesortablecolumns' );
BTW, if you store the post hit value in a custom field (post meta) you could use the Admin Columns Pro plugin. This plugin has an interface for adding new columns to the overview with sorting, filtering and inline edit support.
Related Posts:
- How to add ‘total’ value to custom column title on the posts list page
- How to filter users on admin users page by custom meta field?
- is it possible to add “extra” table nav to edit-tags.php screens?
- What hook do I use to edit the post statuses option in admin?
- post_mime_types Filter not Working in List Mode
- Add quick edit fields without custom colum
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- WordPress Rest filter for custom taxonomy gets applied to the admin area
- user_has_cap filter allows edit but will not allow save
- Taxonomy Custom Column – ‘manage_{TAXONOMY}_custom_column’ filter only passing 2 arguments
- Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies
- Why my admin doesn’t work after adding rest_prepare_post filter?
- views_edit-post filter not working (custom post type)
- Filter out comments with certain meta key/s in the admin backend
- Filter to shorten column content on edit-tags.php
- Filter pre_get_posts does not modify Mine/All/Pending
- Prevent add_filter being applied to wp-admin pages
- How to add attributes to WordPress Admin Sub Menu List Items
- Media upload default title from file name
- Admin post list – adding an option to the date filter dropdown
- How to replace username with email address in users table
- Hide Posts In Back-end/Admin Based On User’s (Pseudo) Privileges Controlled by ACF
- Filter Pages by Custom Field (ACF) in admin area
- Admin: how to make a custom list filter button send GET queryvars
- Echo string in admin panel footer beside version no
- Filter / add_action to upgrade.php page
- How to filter with dropdown in backend for custom data
- Having wp-admin on different domain
- WordPress: Issue with filtering users using date range
- How do I disable the warning “The backup of this post in your browser is different from the version below”?
- manage_users_custom_columns filter not firing callback functions
- Is there a way to override only a portion of the function print_media_templates defined in wp-includes\media-template.php?
- Disable emojicons introduced with WP 4.2
- How to remove a filter that is an anonymous object?
- Adding custom columns to custom post types
- WordPress hooks/filters insert before content or after title
- How to add defer=”defer” tag in plugin javascripts?
- add_action(), add_filter() before or after function
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- What is the very earliest action hook you can call?
- How would one modify the filtering Gutenberg applies to pasted content?
- How can I modify the WordPress default widget output?
- Add custom options to the wplink dialog
- Row actions for custom post types?
- Remove classes from body_class
- what is __return_false in filters
- Explanation for apply_filters function and its variables
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- Insert HTML just after tag
- the_content and is_main_query
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- How to add a custom CSS class to core blocks in Gutenberg editor?
- How to show page content in feed?
- wp_headers vs send_headers. When to use each?
- How can I remove the “Add New” button in my custom post type?
- Filter any HTTP request URI?
- How to Pass External Variables to Filters/Actions
- Filter by one custom field, order by another?
- Not able to change wp_title using add_filter
- How to appending to the_content using add_filter with custom post type?
- Query WP REST API v2 by multiple meta keys
- How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?
- Change or replace user_profile_picture_description filter, to stop stripping whitespace
- Woocommerce price filter widget always shows max price of most expensive product in the whole shop
- remove_function method removing next priority action too while removing current priority
- How to filter the terms of custom taxonomy by author id in admin panel
- Are blocks that are converted to patterns no longer filterable through the_content?
- How to use add_filter to add the extra data to existing array?
- wc_get_template_part filter not working
- hook on the_excerpt
- Deactivate code made with add_filter
- Why wordpress doesn’t allow to add author filter to media library page in grid mode
- ‘Problem’ with login_redirect filter – why does it lose the redirect_to parameter
- What is the best way to ignore wordpress administration using add_filter($title) also when Ajax request
- How could I create real-time filtering in this case?
- How to filter products by category in custom loop
- How to use render_block filter in Gutenberg when editing a page?
- WordPress REST API and Backbone JS
- “Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter
- How do I query Pending posts?
- How to override hook from themes functions.php which is defined in plugin
- How to increase comment length?
- Load More : Admin Ajax 400 Bad request, returning 0
- wp reset password page – head inline script
- add_filter( ‘user_has_cap’,’my_function’, 10, 3 ); and call to get_users in my function triggers an infinite loop in user list
- Custom updater to change plugin version
- Adding custom filter not working
- Core/Image access caption in render_template and in wp.hooks
- Ship block templates or block template parts with plugins
- How to add custom field to top of WordPress Comment Form for both logged in and anon users
- Is it possible to modify a WP search query to return results for private pages when not logged in?
- Filter hook for the action of listing users
- AAPF Filter group is not in widget section
- How can I inject an SVG gradient into the site/theme editor’s head or footer?
- Checking for stock in accordance with product’s SKU
- How to add placeholder into comment form textarea?
- Modify Gutenberg blocks quick inserter defaults