Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/wp-build/templates/page-wp-admin.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_wp_admin_enqueue_scripts( $hook_suf
// Load build constants
$build_constants = require __DIR__ . '/../../constants.php';

// Fire init action for extensions to register routes and menu items
/**
* Fires when the {{PAGE_SLUG}} admin page is initialized so extensions can register routes and menu items.
*/
do_action( '{{PAGE_SLUG}}-wp-admin_init' );

// Preload REST API data
Expand Down
28 changes: 7 additions & 21 deletions packages/wp-build/templates/page.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_render_page() {
wp_dequeue_style( $style );
}

// Fire init action for extensions to register routes and menu items
/**
* Fires when the {{PAGE_SLUG}} page is initialized so extensions can register routes and menu items.
*/
do_action( '{{PAGE_SLUG}}_init' );

// Enqueue command palette assets for boot-based pages
Expand Down Expand Up @@ -267,18 +269,10 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_render_page() {
print_admin_styles();
print_head_scripts();

/**
* Fires in head section for a specific admin page.
*
* @since 2.1.0
*/
/** This action is documented in wp-admin/admin-header.php */
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

/**
* Fires in head section for all admin pages.
*
* @since 2.1.0
*/
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_head' );
// END see wp-admin/admin-header.php
?>
Expand All @@ -288,11 +282,7 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_render_page() {
<?php
// BEGIN see wp-admin/admin-footer.php

/**
* Prints scripts or data before the default footer scripts.
*
* @since 1.2.0
*/
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_footer', '' );

// Print import map first so it's available for inline scripts
Expand All @@ -302,11 +292,7 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_render_page() {
wp_script_modules()->print_script_module_preloads();
wp_script_modules()->print_script_module_data();

/**
* Prints scripts or data after the default footer scripts.
*
* @since 2.8.0
*/
/** This action is documented in wp-admin/admin-footer.php */
do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
// END see wp-admin/admin-footer.php
?>
Expand Down
Loading