: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ), true ) ) {
$details['type'] = 'notice-' . $details['type'];
esc_attr( $details['code'] )
'notice %s settings-error is-dismissible',
esc_attr( $details['type'] )
$output .= "<div id='$css_id' class='$css_class'> \n";
$output .= "<p><strong>{$details['message']}</strong></p>";
* Outputs the modal window used for attaching media to posts or pages in the media-listing screen.
* @param string $found_action Optional. The value of the 'found_action' input field. Default empty string.
function find_posts_div( $found_action = '' ) {
<div id="find-posts" class="find-box" style="display: none;">
<div id="find-posts-head" class="find-box-head">
<?php _e( 'Attach to existing content' ); ?>
<button type="button" id="find-posts-close"><span class="screen-reader-text">
/* translators: Hidden accessibility text. */
_e( 'Close media attachment panel' );
<div class="find-box-inside">
<div class="find-box-search">
<?php if ( $found_action ) { ?>
<input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" />
<input type="hidden" name="affected" id="affected" value="" />
<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
<label class="screen-reader-text" for="find-posts-input">
/* translators: Hidden accessibility text. */
<input type="text" id="find-posts-input" name="ps" value="" />
<span class="spinner"></span>
<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
<div class="clear"></div>
<div id="find-posts-response"></div>
<div class="find-box-buttons">
<?php submit_button( __( 'Select' ), 'primary alignright', 'find-posts-submit', false ); ?>
<div class="clear"></div>
* Displays the post password.
* The password is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute.
function the_post_password() {
if ( isset( $post->post_password ) ) {
echo esc_attr( $post->post_password );
* The post title is fetched and if it is blank then a default string is
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @return string The post title if set.
function _draft_or_post_title( $post = 0 ) {
$title = get_the_title( $post );
$title = __( '(no title)' );
return esc_html( $title );
* Displays the search query.
* A simple wrapper to display the "s" parameter in a `GET` URI. This function
* should only be used when the_search_query() cannot.
function _admin_search_query() {
echo isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
* Generic Iframe header for use with Thickbox.
* @global string $hook_suffix
* @global string $admin_body_class
* @global string $body_id
* @global WP_Locale $wp_locale WordPress date and time locale object.
* @param string $title Optional. Title of the Iframe page. Default empty.
* @param bool $deprecated Not used.
function iframe_header( $title = '', $deprecated = false ) {
global $hook_suffix, $admin_body_class, $body_id, $wp_locale;
$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
$current_screen = get_current_screen();
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
<title><?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?></title>
wp_enqueue_style( 'colors' );
<script type="text/javascript">
addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
pagenow = '<?php echo esc_js( $current_screen->id ); ?>',
typenow = '<?php echo esc_js( $current_screen->post_type ); ?>',
adminpage = '<?php echo esc_js( $admin_body_class ); ?>',
thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>',
decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>',
isRtl = <?php echo (int) is_rtl(); ?>;
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_enqueue_scripts', $hook_suffix );
/** This action is documented in wp-admin/admin-header.php */
do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_styles' );
/** This action is documented in wp-admin/admin-header.php */
do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_scripts' );
/** This action is documented in wp-admin/admin-header.php */
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_head' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
$admin_body_class .= ' rtl';
$admin_body_id = isset( $body_id ) ? 'id="' . $body_id . '" ' : '';
/** This filter is documented in wp-admin/admin-header.php */
$admin_body_classes = apply_filters( 'admin_body_class', '' );
$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class );
<body <?php echo $admin_body_id; ?>class="wp-admin wp-core-ui no-js iframe <?php echo esc_attr( $admin_body_classes ); ?>">
<script type="text/javascript">
var c = document.body.className;
c = c.replace(/no-js/, 'js');
document.body.className = c;
* Generic Iframe footer for use with Thickbox.
function iframe_footer() {
* We're going to hide any footer output on iFrame pages,
* but run the hooks anyway since they output JavaScript
* or other needed content.
* @global string $hook_suffix
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_footer', $hook_suffix );
/** This action is documented in wp-admin/admin-footer.php */
do_action( "admin_print_footer_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_print_footer_scripts' );
<script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>
* Echoes or returns the post states as HTML.
* @since 5.3.0 Added the `$display` parameter and a return value.
* @param WP_Post $post The post to retrieve states for.
* @param bool $display Optional. Whether to display the post states as an HTML string.
* @return string Post states string.
function _post_states( $post, $display = true ) {
$post_states = get_post_states( $post );
$post_states_string = '';
if ( ! empty( $post_states ) ) {
$state_count = count( $post_states );
$post_states_string .= ' — ';
foreach ( $post_states as $state ) {
$separator = ( $i < $state_count ) ? ', ' : '';
$post_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
echo $post_states_string;
return $post_states_string;
* Retrieves an array of post states from a post.
* @param WP_Post $post The post to retrieve states for.
* @return string[] Array of post state labels keyed by their state.
function get_post_states( $post ) {
if ( isset( $_REQUEST['post_status'] ) ) {
$post_status = $_REQUEST['post_status'];
if ( ! empty( $post->post_password ) ) {
$post_states['protected'] = _x( 'Password protected', 'post status' );
if ( 'private' === $post->post_status && 'private' !== $post_status ) {
$post_states['private'] = _x( 'Private', 'post status' );
if ( 'draft' === $post->post_status ) {
if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) {
$post_states[] = __( 'Customization Draft' );
} elseif ( 'draft' !== $post_status ) {
$post_states['draft'] = _x( 'Draft', 'post status' );
} elseif ( 'trash' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) {
$post_states[] = _x( 'Customization Draft', 'post status' );
if ( 'pending' === $post->post_status && 'pending' !== $post_status ) {
$post_states['pending'] = _x( 'Pending', 'post status' );
if ( is_sticky( $post->ID ) ) {
$post_states['sticky'] = _x( 'Sticky', 'post status' );
if ( 'future' === $post->post_status ) {
$post_states['scheduled'] = _x( 'Scheduled', 'post status' );
if ( 'page' === get_option( 'show_on_front' ) ) {
if ( (int) get_option( 'page_on_front' ) === $post->ID ) {
$post_states['page_on_front'] = _x( 'Front Page', 'page label' );
if ( (int) get_option( 'page_for_posts' ) === $post->ID ) {
$post_states['page_for_posts'] = _x( 'Posts Page', 'page label' );
if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
$post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' );
* Filters the default post display states used in the posts list table.
* @since 3.6.0 Added the `$post` parameter.
* @since 5.5.0 Also applied in the Customizer context. If any admin functions
* are used within the filter, their existence should be checked
* with `function_exists()` before being used.
* @param string[] $post_states An array of post display states.
* @param WP_Post $post The current post object.
return apply_filters( 'display_post_states', $post_states, $post );
* Outputs the attachment media states as HTML.
* @since 5.6.0 Added the `$display` parameter and a return value.
* @param WP_Post $post The attachment post to retrieve states for.
* @param bool $display Optional. Whether to display the post states as an HTML string.
* @return string Media states string.
function _media_states( $post, $display = true ) {
$media_states = get_media_states( $post );
$media_states_string = '';
if ( ! empty( $media_states ) ) {
$state_count = count( $media_states );
$media_states_string .= ' — ';
foreach ( $media_states as $state ) {
$separator = ( $i < $state_count ) ? ', ' : '';
$media_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
echo $media_states_string;
return $media_states_string;
* Retrieves an array of media states from an attachment.
* @param WP_Post $post The attachment to retrieve states for.
* @return string[] Array of media state labels keyed by their state.
function get_media_states( $post ) {
$stylesheet = get_option( 'stylesheet' );
if ( current_theme_supports( 'custom-header' ) ) {
$meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );
if ( is_random_header_image() ) {
if ( ! isset( $header_images ) ) {
$header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) {
$media_states[] = __( 'Header Image' );
$header_image = get_header_image();
// Display "Header Image" if the image was ever used as a header image.
if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) {
$media_states[] = __( 'Header Image' );
// Display "Current Header Image" if the image is currently the header image.
if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) {
$media_states[] = __( 'Current Header Image' );
if ( get_theme_support( 'custom-header', 'video' ) && has_header_video() ) {
$mods = get_theme_mods();
if ( isset( $mods['header_video'] ) && $post->ID === $mods['header_video'] ) {
$media_states[] = __( 'Current Header Video' );
if ( current_theme_supports( 'custom-background' ) ) {
$meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true );
if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) {
$media_states[] = __( 'Background Image' );
$background_image = get_background_image();
if ( $background_image && wp_get_attachment_url( $post->ID ) === $background_image ) {
$media_states[] = __( 'Current Background Image' );
if ( (int) get_option( 'site_icon' ) === $post->ID ) {
$media_states[] = __( 'Site Icon' );
if ( (int) get_theme_mod( 'custom_logo' ) === $post->ID ) {
$media_states[] = __( 'Logo' );
* Filters the default media display states for items in the Media list table.
* @since 4.8.0 Added the `$post` parameter.
* @param string[] $media_states An array of media states. Default 'Header Image',
* 'Background Image', 'Site Icon', 'Logo'.
* @param WP_Post $post The current attachment object.
return apply_filters( 'display_media_states', $media_states, $post );
* Tests support for compressing JavaScript from PHP.
* Outputs JavaScript that tests if compression from PHP works as expected
* and sets an option with the result. Has no effect when the current user
* is not an administrator. To run the test again the option 'can_compress_scripts'
function compression_test() {
<script type="text/javascript">
var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ) ); ?>;
if ( window.XMLHttpRequest ) {
x = new XMLHttpRequest();
try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}
x.onreadystatechange = function() {
if ( x.readyState == 4 ) {
r = x.responseText.substr(0, 18);
h = x.getResponseHeader('Content-Encoding');