Docs / Page Template Usage
Page Template Usage
See which template every page uses, and fix pages on a missing template.
Hooks
Every default, limit and message has a filter, and every change fires an action.
axle_page_template_usage_post_typesFilter( string[] $post_types )Post types to look at. Types without templates are left out on their own
axle_page_template_usage_sortableFilter( bool $sortable, string $post_type )Return false to turn off sorting by template, which joins postmeta and is slow on very large sites
axle_page_template_usage_capabilityFilter( string $capability )Who may open Appearance > Axle Page Template Usage. Default edit_pages
axle_page_template_usage_can_access_post_typeFilter( bool $allowed, string $post_type )Whether the current user may see and change the templates of a post type, on every screen and in every ability. Default: the capability above and edit_posts on the post type
axle_page_template_usage_move_limitFilter( int $limit, string $post_type )Items one Move click handles. Default 500
axle_page_template_usage_show_missing_noticeFilter( bool $show, string $post_type, int $missing )Whether the list screen warns about items on missing templates
axle_page_template_usage_before_reassignAction( string $post_type, string $from, string $to, int $limit )Fires before items move, from the screen or WP-CLI
axle_page_template_usage_reassignedAction( string $post_type, string $from, string $to, int[] $post_ids )Fires for every batch of items moved
axle_page_template_usage_theme_check_capabilityFilter( string $capability )Who may check a theme before switching, and save or remove a plan for it. Default switch_themes
axle_page_template_usage_theme_templatesFilter( array $templates, string $stylesheet, string $post_type, WP_Theme $theme )Templates a theme that is not active offers, when checking it
axle_page_template_usage_theme_check_sample_sizeFilter( int $size )Example items listed under each template in the check. Default 5
axle_page_template_usage_theme_mappingFilter( array $mapping, string $stylesheet )The plan used on activation, post type => ( from => to ). missing as from means every template the theme lacks
axle_page_template_usage_switch_batch_sizeFilter( int $size, string $stylesheet )Items moved per request after a theme switch. Default 500, the rest follows in the background
axle_page_template_usage_apply_on_switchFilter( bool $apply, string $stylesheet )Return false to keep the plan and run it by hand
axle_page_template_usage_show_switch_noticeFilter( bool $show, array $state )Whether the notice with the Undo shows after a switch
axle_page_template_usage_mapping_savedAction( string $stylesheet, array $mapping )Fires after a plan is saved or cleared (empty mapping)
axle_page_template_usage_mapping_appliedAction( string $stylesheet, array $state )Fires after items moved to match a theme that was just activated, once per run
axle_page_template_usage_history_capFilter( int $cap )Changes the history keeps, oldest dropped first. Default 10000, minimum 100
axle_page_template_usage_history_retention_daysFilter( int $days )Days an entry is kept. Default 365, 0 for no age limit
axle_page_template_usage_history_should_recordFilter( bool $record, array $entry )Return false to leave a change out of the history
axle_page_template_usage_history_recordedAction( array $entry )Fires when a change is recorded, before it is written
axle_page_template_usage_history_per_pageFilter( int $per_page )Entries per page on the History tab. Default 20
axle_page_template_usage_history_source_labelsFilter( array $labels )Names shown for the source of a change
axle_page_template_usage_can_undoFilter( bool $allowed, object $entry )Last word on whether an entry may be undone
axle_page_template_usage_undo_limitFilter( int $limit )Changes one "Undo this batch" click handles. Default 500
axle_page_template_usage_undoneAction( object $entry )Fires after one change was undone
axle_page_template_usage_batch_undoneAction( string $batch, array $summary )Fires after a batch was undone, in whole or in part
No hook matches that. Try a shorter word.
WP-CLI
wp axle-page-template-usage list [--post_type=<type>] [--status=<status>] [--format=<format>]Abilities
What AI agents can do through the WordPress Abilities API and MCP, with the same permissions as the screen.
axle-page-template-usage/get-reportRead-only. Every template for post_type (default page) with how many items use it, and the number on missing templates
Who can run it: the Axle Page Template Usage capability and edit_posts on the post type
axle-page-template-usage/reassignMoves items from from (a template, default or missing) to to, at most 500 per run, skipping items the user cannot edit. Returns moved, skipped, remaining and the batch ID of the move
Who can run it: the Axle Page Template Usage capability and edit_posts on the post type
axle-page-template-usage/check-themeRead-only. For an installed theme that is not active (theme), which items would lose their template, grouped by template with counts, and what a saved plan uses instead. Only post types the user can edit
Who can run it: the Axle Page Template Usage capability, the theme check capability, and edit_posts on post_type when one is given
axle-page-template-usage/get-historyRead-only. Recorded template changes of the post types the user can edit, newest first, filtered by post_id, source or batch, with whether each can still be undone
Who can run it: the Axle Page Template Usage capability
The full reference, with the PHP API and examples, is in REFERENCE.md for version 3.1.1