Skip to content

Commit

Permalink
Editor: Add function prefix to avoid conflicts.
Browse files Browse the repository at this point in the history
Transforms `initialize_theme_preview_hooks` to `wp_initialize_theme_preview_hooks` to avoid conflicts with third-party code.

Follow up to [56529].

Props okat.
See #59000.


git-svn-id: https://develop.svn.wordpress.org/trunk@56757 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
danielbachhuber committed Oct 2, 2023
1 parent bc259dd commit a1852bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
add_action( 'transition_post_status', '_wp_keep_alive_customize_changeset_dependent_auto_drafts', 20, 3 );

// Block Theme Previews.
add_action( 'plugins_loaded', 'initialize_theme_preview_hooks', 1 );
add_action( 'plugins_loaded', 'wp_initialize_theme_preview_hooks', 1 );

// Calendar widget cache.
add_action( 'save_post', 'delete_get_calendar_cache' );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/theme-previews.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function wp_block_theme_activate_nonce() {
*
* @since 6.3.2
*/
function initialize_theme_preview_hooks() {
function wp_initialize_theme_preview_hooks() {
if ( ! empty( $_GET['wp_theme_preview'] ) ) {
add_filter( 'stylesheet', 'wp_get_theme_preview_path' );
add_filter( 'template', 'wp_get_theme_preview_path' );
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/theme-previews.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function tear_down() {

public function test_initialize_theme_preview_hooks() {
$_GET['wp_theme_preview'] = 'twentytwentythree';
do_action( 'plugins_loaded' ); // Ensure `plugins_loaded` triggers `initialize_theme_preview_hooks`.
do_action( 'plugins_loaded' ); // Ensure `plugins_loaded` triggers `wp_initialize_theme_preview_hooks`.

$this->assertEquals( has_filter( 'stylesheet', 'wp_get_theme_preview_path' ), 10 );
$this->assertEquals( has_filter( 'template', 'wp_get_theme_preview_path' ), 10 );
Expand Down

0 comments on commit a1852bd

Please sign in to comment.