Title: wp_initialize_site_preview_hooks
Published: April 28, 2025
Last modified: February 24, 2026

---

# wp_initialize_site_preview_hooks()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#wp--skip-link--target)

Initialize site preview.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#description)󠁿

This function sets IFRAME_REQUEST to true if the site preview parameter is set.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#source)󠁿

    ```php
    function wp_initialize_site_preview_hooks() {
    	if (
    		! defined( 'IFRAME_REQUEST' ) &&
    		isset( $_GET['wp_site_preview'] ) &&
    		1 === (int) $_GET['wp_site_preview'] &&
    		current_user_can( 'edit_theme_options' )
    	) {
    		define( 'IFRAME_REQUEST', true );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/block-editor.php#L875)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/block-editor.php#L875-L884)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#related)󠁿

| Uses | Description | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_initialize_site_preview_hooks/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.8.0](https://developer.wordpress.org/reference/since/6.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_initialize_site_preview_hooks%2F)
before being able to contribute a note or feedback.