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?
- Trouble understanding apply_filters()
- How would one modify the filtering Gutenberg applies to pasted content?
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- How to add a custom CSS class to core blocks in Gutenberg editor?
- How to filter by post-format in admin?
- Filter translations (gettext strings) on specific admin pages
- Is it possible to use object in add_action?
- Filter hook before create order WooCommerce
- add_filter for specific pages
- How to add attribute to output with wp_video_shortcode add_filter
- How to override the email function by using filters? [closed]
- Remove WPML’s home_url filter
- Change default settings used by gallery shortcode
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Add ‘if exists’ to filter
- How to get current action?
- How to check if “media_send_to_editor” is audio?
- Changing Order of Filters
- how to change appearence of the content of default post list columns?
- Use safety filters even if after applied intval?
- How can I filter block registration based on post-type? (Block alignment settings)
- Modify site URL via functions.php of a theme
- Yoast SEO hooks overriding themselves
- Passing variable from child theme to parent theme
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- Replace a word with a word in the URL string
- Redirect to checkout woocommerce failed
- wp_insert_post_data filter hook identify current action
- Modifying a CoBlocks Filter in Functions
- Shortcodes — Using add_action, add_filter in the shortcode
- Remove Content Filter
- Upload file if contains certain name
- Filters/Bulk Actions return wrong URL in admin dashboard
- How to know what filter to use and how to use it?
- how to use force_filtered_html_on_import in add_filter?
- Filter Hook callback error, is it due to using $this inside a filter or something else?
- Disadvantage of using filters & hooks multiple times
- How To Override A WooCommerce AJAX Function
- Can I override the content array using the_posts filter?
- How to use do_shortcode_tag to modify the output of a shortcode?
- Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
- How to trim white space in search terms?
- Changing the argument of a function
- Alter existing page contents based on url
- How to include add_filter() in a condition based on $post data
- Remove pretty photo style and script if not exist!
- custom gallery filter with image caption as link title?
- Is this hook really deprecated? ( manage_{$taxonomy}_custom_column )
- The gettext hook doesnt work on text with links
- the_content getting current page content instead specified ID
- “The editor has encountered an unexpected error” After add defer tag to java script
- the wp_post_update isn’t working all the time
- Hook to add content after date in post?
- Create different flavours of excerpt
- Search with filters
- Dealing with the clickTrack event in wp-playlist.js in order to display audio download link on the playlist title row
- How do I isolate the reason a wordpress filter is not running?
- How to remove the post pagination (Next page tag) depending on type of traffic source: from utm_campain or non-utm_campain
- Change url to posts if they have custom tax only
- How to get to the date of the uploaded file
- Can’t get content of all (19) posts – Incomplete Chunked Encoding
- Customize register form page with add_action or apply_filter
- How to separate a specific page’s comments from other comments
- Woocommerce: Only one review per verified buyer [closed]
- Filter widget_pages_args not working in Pages Widget
- This code works, but breaks the media uploader. How do I integrate it in a way that won’t?
- How to add placeholder into comment form textarea?