wp_print_admin_notice_templates

The timeline below displays how wordpress function wp_print_admin_notice_templates has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Prints the JavaScript templates for update admin notices.
 *
 * @since 4.6.0
 *
 * Template takes one argument with four values:
 *
 *     param {object} data {
 *         Arguments for admin notice.
 *
 *         @type string id        ID of the notice.
 *         @type string className Class names for the notice.
 *         @type string message   The notice's message.
 *         @type string type      The type of update the notice is for. Either 'plugin' or 'theme'.
 *     }
 */
function wp_print_admin_notice_templates()
{
    ?>
	<script id="tmpl-wp-updates-admin-notice" type="text/html">
		<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
	</script>
	<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
		<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
			<p>
				<# if ( data.successes ) { #>
					<# if ( 1 === data.successes ) { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins. */
    printf(__('%s plugin successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes. */
    printf(__('%s theme successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } else { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins. */
    printf(__('%s plugins successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes. */
    printf(__('%s themes successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } #>
				<# } #>
				<# if ( data.errors ) { #>
					<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
						<# if ( 1 === data.errors ) { #>
							<?php 
    /* translators: %s: Number of failed updates. */
    printf(__('%s update failed.'), '{{ data.errors }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of failed updates. */
    printf(__('%s updates failed.'), '{{ data.errors }}');
    ?>
						<# } #>
						<span class="screen-reader-text">
							<?php 
    /* translators: Hidden accessibility text. */
    _e('Show more details');
    ?>
						</span>
						<span class="toggle-indicator" aria-hidden="true"></span>
					</button>
				<# } #>
			</p>
			<# if ( data.errors ) { #>
				<ul class="bulk-action-errors hidden">
					<# _.each( data.errorMessages, function( errorMessage ) { #>
						<li>{{ errorMessage }}</li>
					<# } ); #>
				</ul>
			<# } #>
		</div>
	</script>
	<?php 
}

WordPress Version: 6.1

/**
 * Prints the JavaScript templates for update admin notices.
 *
 * @since 4.6.0
 *
 * Template takes one argument with four values:
 *
 *     param {object} data {
 *         Arguments for admin notice.
 *
 *         @type string id        ID of the notice.
 *         @type string className Class names for the notice.
 *         @type string message   The notice's message.
 *         @type string type      The type of update the notice is for. Either 'plugin' or 'theme'.
 *     }
 */
function wp_print_admin_notice_templates()
{
    ?>
	<script id="tmpl-wp-updates-admin-notice" type="text/html">
		<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
	</script>
	<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
		<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
			<p>
				<# if ( data.successes ) { #>
					<# if ( 1 === data.successes ) { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins. */
    printf(__('%s plugin successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes. */
    printf(__('%s theme successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } else { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins. */
    printf(__('%s plugins successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes. */
    printf(__('%s themes successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } #>
				<# } #>
				<# if ( data.errors ) { #>
					<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
						<# if ( 1 === data.errors ) { #>
							<?php 
    /* translators: %s: Number of failed updates. */
    printf(__('%s update failed.'), '{{ data.errors }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of failed updates. */
    printf(__('%s updates failed.'), '{{ data.errors }}');
    ?>
						<# } #>
						<span class="screen-reader-text"><?php 
    _e('Show more details');
    ?></span>
						<span class="toggle-indicator" aria-hidden="true"></span>
					</button>
				<# } #>
			</p>
			<# if ( data.errors ) { #>
				<ul class="bulk-action-errors hidden">
					<# _.each( data.errorMessages, function( errorMessage ) { #>
						<li>{{ errorMessage }}</li>
					<# } ); #>
				</ul>
			<# } #>
		</div>
	</script>
	<?php 
}

WordPress Version: 5.3

/**
 * Prints the JavaScript templates for update admin notices.
 *
 * Template takes one argument with four values:
 *
 *     param {object} data {
 *         Arguments for admin notice.
 *
 *         @type string id        ID of the notice.
 *         @type string className Class names for the notice.
 *         @type string message   The notice's message.
 *         @type string type      The type of update the notice is for. Either 'plugin' or 'theme'.
 *     }
 *
 * @since 4.6.0
 */
function wp_print_admin_notice_templates()
{
    ?>
	<script id="tmpl-wp-updates-admin-notice" type="text/html">
		<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
	</script>
	<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
		<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
			<p>
				<# if ( data.successes ) { #>
					<# if ( 1 === data.successes ) { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins. */
    printf(__('%s plugin successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes. */
    printf(__('%s theme successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } else { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins. */
    printf(__('%s plugins successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes. */
    printf(__('%s themes successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } #>
				<# } #>
				<# if ( data.errors ) { #>
					<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
						<# if ( 1 === data.errors ) { #>
							<?php 
    /* translators: %s: Number of failed updates. */
    printf(__('%s update failed.'), '{{ data.errors }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of failed updates. */
    printf(__('%s updates failed.'), '{{ data.errors }}');
    ?>
						<# } #>
						<span class="screen-reader-text"><?php 
    _e('Show more details');
    ?></span>
						<span class="toggle-indicator" aria-hidden="true"></span>
					</button>
				<# } #>
			</p>
			<# if ( data.errors ) { #>
				<ul class="bulk-action-errors hidden">
					<# _.each( data.errorMessages, function( errorMessage ) { #>
						<li>{{ errorMessage }}</li>
					<# } ); #>
				</ul>
			<# } #>
		</div>
	</script>
	<?php 
}

WordPress Version: 4.6

/**
 * Prints the JavaScript templates for update admin notices.
 *
 * Template takes one argument with four values:
 *
 *     param {object} data {
 *         Arguments for admin notice.
 *
 *         @type string id        ID of the notice.
 *         @type string className Class names for the notice.
 *         @type string message   The notice's message.
 *         @type string type      The type of update the notice is for. Either 'plugin' or 'theme'.
 *     }
 *
 * @since 4.6.0
 */
function wp_print_admin_notice_templates()
{
    ?>
	<script id="tmpl-wp-updates-admin-notice" type="text/html">
		<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
	</script>
	<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
		<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
			<p>
				<# if ( data.successes ) { #>
					<# if ( 1 === data.successes ) { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins */
    printf(__('%s plugin successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes */
    printf(__('%s theme successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } else { #>
						<# if ( 'plugin' === data.type ) { #>
							<?php 
    /* translators: %s: Number of plugins */
    printf(__('%s plugins successfully updated.'), '{{ data.successes }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of themes */
    printf(__('%s themes successfully updated.'), '{{ data.successes }}');
    ?>
						<# } #>
					<# } #>
				<# } #>
				<# if ( data.errors ) { #>
					<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
						<# if ( 1 === data.errors ) { #>
							<?php 
    /* translators: %s: Number of failed updates */
    printf(__('%s update failed.'), '{{ data.errors }}');
    ?>
						<# } else { #>
							<?php 
    /* translators: %s: Number of failed updates */
    printf(__('%s updates failed.'), '{{ data.errors }}');
    ?>
						<# } #>
						<span class="screen-reader-text"><?php 
    _e('Show more details');
    ?></span>
						<span class="toggle-indicator" aria-hidden="true"></span>
					</button>
				<# } #>
			</p>
			<# if ( data.errors ) { #>
				<ul class="bulk-action-errors hidden">
					<# _.each( data.errorMessages, function( errorMessage ) { #>
						<li>{{ errorMessage }}</li>
					<# } ); #>
				</ul>
			<# } #>
		</div>
	</script>
	<?php 
}