Custom Post Type Widgets 1.5.3 has 4 actions and 17 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when Custom Post Type Widgets fires an action
add_action( 'custom_post_type_widgets/recent_posts/widget/after', function( $id, $posttype, $instance ) {
// Your code runs here.
}, 10, 3 );
// Change a value Custom Post Type Widgets is about to use
add_filter( 'widget_title', function( $title, $instance, $id_base ) {
// Change $title here.
return $title;
}, 10, 3 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ apply_filters( 'widget_title', $title, $instance, $this->id_base ); -
custom_post_type_widgets/calendar/get_custom_post_type_calendar
filter Copy link Customise this hook/** * Filters the HTML calendar output. */ apply_filters( 'custom_post_type_widgets/calendar/get_custom_post_type_calendar', $cache[ $key ] ); -
/** * Filter a daylink. */ apply_filters( 'custom_post_type_widgets/archive/get_day_link_custom_post_type', $new_daylink, $year, $month, $day, $old_daylink ); -
custom_post_type_widgets/archive/get_month_link_custom_post_type
filter Copy link Customise this hook/** * Filter a monthlink. */ apply_filters( 'custom_post_type_widgets/archive/get_month_link_custom_post_type', $new_monthlink, $year, $month, $old_monthlink ); -
custom_post_type_widgets/archive/get_year_link_custom_post_type
filter Copy link Customise this hook/** * Filter a yearlink. */ apply_filters( 'custom_post_type_widgets/archive/get_year_link_custom_post_type', $new_yearlink, $year, $old_yearlink ); -
/** * Filter a trimed link_html. */ apply_filters( 'custom_post_type_widgets/archive/trim_post_type', $new_link_html, $old_link_html, $posttype ); -
/** * Filters the arguments for the Archives widget. */ apply_filters( 'custom_post_type_widgets/archive/widget_archives_args', array( 'post_type' => $posttype, 'type' => $archive_type, 'format' => 'html', 'show_post_count' => $count, 'order' => $order, ), $instance, $this->id, $posttype ); -
/** * Filters the arguments for the Archives widget drop-down. */ apply_filters( 'custom_post_type_widgets/archive/widget_archives_dropdown_args', array( 'post_type' => $posttype, 'type' => $archive_type, 'format' => 'option', 'show_post_count' => $count, 'order' => $order, ), $instance, $this->id, $posttype ); -
custom_post_type_widgets/calendar/get_day_link_custom_post_type
filter Copy link Customise this hook/** * Filter a daylink. */ apply_filters( 'custom_post_type_widgets/calendar/get_day_link_custom_post_type', $daylink, $year, $month, $day ); -
custom_post_type_widgets/calendar/get_month_link_custom_post_type
filter Copy link Customise this hook/** * Filter a monthlink. */ apply_filters( 'custom_post_type_widgets/calendar/get_month_link_custom_post_type', $monthlink, $year, $month ); -
/** * Filters the arguments for the Categories widget. */ apply_filters( 'custom_post_type_widgets/categories/widget_categories_args', $cat_args, $instance, $this->id, $taxonomy ); -
custom_post_type_widgets/categories/widget_categories_dropdown_args
filter Copy link Customise this hook/** * Filters the arguments for the Categories widget drop-down. */ apply_filters( 'custom_post_type_widgets/categories/widget_categories_dropdown_args', $cat_args, $instance, $this->id, $taxonomy ); -
/** * Filters the arguments for the Recent Comments widget. */ apply_filters( 'custom_post_type_widgets/recent_comments/widget_comments_args', array( 'post_type' => $posttype, 'number' => $number, 'status' => 'approve', 'post_status' => 'publish', ), $instance, $this->id, $posttype ); -
/** * Filters the arguments for the Recent Posts widget. */ apply_filters( 'custom_post_type_widgets/recent_posts/widget_posts_args', array( 'post_type' => $posttype, 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance, $this->id, $posttype ); -
/** * Actions the arguments for the Recent Posts widget. */ do_action( 'custom_post_type_widgets/recent_posts/widget/after', $this->id, $posttype, $instance ); -
/** * Actions the arguments for the Recent Posts widget. */ do_action( 'custom_post_type_widgets/recent_posts/widget/append', $this->id, $posttype, $instance, $recent_post ); -
/** * Actions the arguments for the Recent Posts widget. */ do_action( 'custom_post_type_widgets/recent_posts/widget/before', $this->id, $posttype, $instance ); -
/** * Actions the arguments for the Recent Posts widget. */ do_action( 'custom_post_type_widgets/recent_posts/widget/prepend', $this->id, $posttype, $instance, $recent_post ); -
/** * Filters the arguments for the Search widget. */ apply_filters( 'custom_post_type_widgets/search/filter_post_type', $filter_post_type ); -
/** * Filters the taxonomy used in the Tag Cloud widget. */ apply_filters( 'custom_post_type_widgets/tag_cloud/widget_tag_cloud_args', array( 'taxonomy' => $taxonomy, 'echo' => false, 'show_count' => $show_count, ), $instance, $this->id, $taxonomy ); -
/** * Filters the Recent Comments default widget styles. */ apply_filters( 'show_recent_comments_widget_style', true, $this->id_base );
Generated from Custom Post Type Widgets's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: