Enable the editor for post types
Use the post-type availability filter to add or remove WordPress content types supported by the trip editor.
On this page
WP Trip Summary normally enables its editor only for the built-in post and page post types. Since version 0.2.8, integrations can change this list with the abp01_trip_summary_available_for_post_types filter.
The filter receives one argument: the current array of post-type slugs. Return the complete array that should support the WP Trip Summary editor.
Enable a custom post type
function e01_get_trip_summary_available_for_post_types($postTypes) {
$newPostTypes = $postTypes;
if (!in_array('e01_sample_post_type', $newPostTypes, true)) {
$newPostTypes[] = 'e01_sample_post_type';
}
return $newPostTypes;
}
function e01_init() {
add_filter(
'abp01_trip_summary_available_for_post_types',
'e01_get_trip_summary_available_for_post_types',
1
);
}
add_action('init', 'e01_init');
This is based on the repository’s custom post-type integration example.
Remove an existing post type
function my_wpts_supported_post_types($postTypes) {
return array_values(array_diff($postTypes, array('page')));
}
add_filter('abp01_trip_summary_available_for_post_types', 'my_wpts_supported_post_types');
Enable several post types
function my_wpts_supported_post_types($postTypes) {
return array_values(array_unique(array_merge(
$postTypes,
array('route', 'rail_journey')
)));
}
add_filter('abp01_trip_summary_available_for_post_types', 'my_wpts_supported_post_types');
Front-end viewer behavior
No separate viewer integration is required. WP Trip Summary renders the front-end viewer only when the current singular entry has trip-summary data to display.
Integration checklist
- Use registered post-type slugs, not their display labels.
- Always return an array, including when no changes are needed.
- Avoid duplicate slugs when several plugins use the filter.
- Test creating, editing and saving the custom post type.
- Confirm the viewer appears only for entries with trip data.
- Keep this integration outside WP Trip Summary core so plugin updates do not overwrite it.
The canonical project example registers the filter from the WordPress init action at priority 1.