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
- How to remove a filter that is an anonymous object?
- No filter of code on switch from html to visual editor, how?
- How to modify posts_where filter only for the search query
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to add filter with 2 args?
- sortable custom column in media library
- Adding revision support to WooCommerce product content
- Changing text within the Block Editor
- Search content for shortcodes and get parameters
- How Can I Have A URL Changed Based on the Originating URL?
- Is it possible to Hook/Filters Attachment Creation?
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- How to hook some Unicode texts into calendar widget safely?
- how to remove filter from wordpress shortcode output
- Change email from and display name with a filter action
- WordPress tag cloud add more links
- Question about how do wordpress filters/actions work
- How to center oEmbedded content
- When adding buttons to the tinyMCE editor, how do I make them wrap to the next line and/or display in the “Kitchen Sink” area?
- When does wordpress process <!–nextpage–>
- Remove style `?ver=` from `/wp-admin/upgrade.php`
- Add attribute to script loaded by the theme
- Correct way to filter get_pages() function
- theme_page_templates not working
- Filter custom post type using multiple taxonomy dropdowns
- Add new post with predefined / preset date
- Remove Extra Classes from Post Title
- I want to allow the use of a data-flw attribute in links in comments
- What hooks to hook onto for automatic cache clearing
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Modify Redux Framework Options in Child Theme
- How can I output all apply_filters and do_action?
- Override has_post_thumbnail function
- How to allow code block in wordpress comments
- remove_action: how to access to a method in an child class?
- Set default value for “Additional CSS class(es)” for specific block types
- Contact Form 7 Custom Validation Doesn’t Get Called [closed]
- add_filter to wp_nav_menu_objects having no impact
- Trimming a custom field to a length
- Using add_filter to modify a public function of a class
- How to hide/remove GhostKit component panel in gutenberg block inspector
- WordPress removing slashes from shortcode output
- when use function the_content break
- Filter page title (displayed in browser tab) of wp-login
- Adding html banner to posts
- conditional search
- output custom Posts on a Page
- Filter “Your latest posts”
- Hide certain product filters from specific product categories
- Hooked into wp_get_attachment_caption to add content to the default description; not working for jetpack slideshow. Why?
- WordPress Gutenberg core/heading block (wp-block-heading)
- Add an attribute to the root from functions.php with add_filter
- Would like to use hook or filters to customize email templates
- Removing menus from users other than the administrator
- Can’t understand apply_filter logic
- Modify oembed code conditionally
- How can I add a prefix to titles displayed in sidebar using function.php?
- Modify Default URL for /wp-includes/js/wp-emoji.js?ver=4.6.1
- List all image sizes still getting disabled sizes
- wp_editor customization
- What problems could happen if I replaced add_filter and add_action with the function calling
- posts_results filter function memory errors
- Custome column sort by date not title
- Adding to an array & passing it through do_action/apply_filters
- Loading a sidebar on an Ajax call
- the_excerpt() does not work with has_excerpt()?
- How do you disable the verification process of user email changes?
- Modify the third (context) parameter in a filter?
- Adding filter to the Contact Form 7 response