: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below).
'format' => $format, // ?page=%#% : %#% is replaced by the page number.
'aria_current' => 'page',
'prev_text' => __( '« Previous' ),
'next_text' => __( 'Next »' ),
'add_args' => array(), // Array of query args to add.
'before_page_number' => '',
'after_page_number' => '',
$args = wp_parse_args( $args, $defaults );
if ( ! is_array( $args['add_args'] ) ) {
$args['add_args'] = array();
// Merge additional query vars found in the original URL into 'add_args' array.
if ( isset( $url_parts[1] ) ) {
// Find the format argument.
$format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) );
$format_query = isset( $format[1] ) ? $format[1] : '';
wp_parse_str( $format_query, $format_args );
// Find the query args of the requested URL.
wp_parse_str( $url_parts[1], $url_query_args );
// Remove the format argument from the array of query arguments, to avoid overwriting custom format.
foreach ( $format_args as $format_arg => $format_arg_value ) {
unset( $url_query_args[ $format_arg ] );
$args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) );
// Who knows what else people pass in $args.
$total = (int) $args['total'];
$current = (int) $args['current'];
$end_size = (int) $args['end_size']; // Out of bounds? Make it the default.
$mid_size = (int) $args['mid_size'];
$add_args = $args['add_args'];
if ( $args['prev_next'] && $current && 1 < $current ) :
$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
$link = str_replace( '%#%', $current - 1, $link );
$link = add_query_arg( $add_args, $link );
$link .= $args['add_fragment'];
'<a class="prev page-numbers" href="%s">%s</a>',
* Filters the paginated links for the given archive pages.
* @param string $link The paginated link URL.
esc_url( apply_filters( 'paginate_links', $link ) ),
for ( $n = 1; $n <= $total; $n++ ) :
'<span aria-current="%s" class="page-numbers current">%s</span>',
esc_attr( $args['aria_current'] ),
$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
$link = str_replace( '%#%', $n, $link );
$link = add_query_arg( $add_args, $link );
$link .= $args['add_fragment'];
'<a class="page-numbers" href="%s">%s</a>',
/** This filter is documented in wp-includes/general-template.php */
esc_url( apply_filters( 'paginate_links', $link ) ),
$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
elseif ( $dots && ! $args['show_all'] ) :
$page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>';
if ( $args['prev_next'] && $current && $current < $total ) :
$link = str_replace( '%_%', $args['format'], $args['base'] );
$link = str_replace( '%#%', $current + 1, $link );
$link = add_query_arg( $add_args, $link );
$link .= $args['add_fragment'];
'<a class="next page-numbers" href="%s">%s</a>',
/** This filter is documented in wp-includes/general-template.php */
esc_url( apply_filters( 'paginate_links', $link ) ),
switch ( $args['type'] ) {
$r .= "<ul class='page-numbers'>\n\t<li>";
$r .= implode( "</li>\n\t<li>", $page_links );
$r = implode( "\n", $page_links );
* Filters the HTML output of paginated links for archives.
* @param string $r HTML output.
* @param array $args An array of arguments. See paginate_links()
* for information on accepted arguments.
$r = apply_filters( 'paginate_links_output', $r, $args );
* Registers an admin color scheme css file.
* Allows a plugin to register a new admin color scheme. For example:
* wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array(
* '#07273E', '#14568A', '#D54E21', '#2683AE'
* @global array $_wp_admin_css_colors
* @param string $key The unique key for this theme.
* @param string $name The name of the theme.
* @param string $url The URL of the CSS file containing the color scheme.
* @param array $colors Optional. An array of CSS color definition strings which are used
* to give the user a feel for the theme.
* Optional. CSS color definitions used to color any SVG icons.
* @type string $base SVG icon base color.
* @type string $focus SVG icon color on focus.
* @type string $current SVG icon color of current admin menu link.
function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
global $_wp_admin_css_colors;
if ( ! isset( $_wp_admin_css_colors ) ) {
$_wp_admin_css_colors = array();
$_wp_admin_css_colors[ $key ] = (object) array(
* Registers the default admin color schemes.
* Registers the initial set of eight color schemes in the Profile section
* of the dashboard which allows for styling the admin menu and toolbar.
* @see wp_admin_css_color()
function register_admin_color_schemes() {
$suffix = is_rtl() ? '-rtl' : '';
$suffix .= SCRIPT_DEBUG ? '' : '.min';
_x( 'Default', 'admin color scheme' ),
array( '#1d2327', '#2c3338', '#2271b1', '#72aee6' ),
_x( 'Light', 'admin color scheme' ),
admin_url( "css/colors/light/colors$suffix.css" ),
array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ),
_x( 'Modern', 'admin color scheme' ),
admin_url( "css/colors/modern/colors$suffix.css" ),
array( '#1e1e1e', '#3858e9', '#33f078' ),
_x( 'Blue', 'admin color scheme' ),
admin_url( "css/colors/blue/colors$suffix.css" ),
array( '#096484', '#4796b3', '#52accc', '#74B6CE' ),
_x( 'Midnight', 'admin color scheme' ),
admin_url( "css/colors/midnight/colors$suffix.css" ),
array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ),
_x( 'Sunrise', 'admin color scheme' ),
admin_url( "css/colors/sunrise/colors$suffix.css" ),
array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ),
_x( 'Ectoplasm', 'admin color scheme' ),
admin_url( "css/colors/ectoplasm/colors$suffix.css" ),
array( '#413256', '#523f6d', '#a3b745', '#d46f15' ),
_x( 'Ocean', 'admin color scheme' ),
admin_url( "css/colors/ocean/colors$suffix.css" ),
array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ),
_x( 'Coffee', 'admin color scheme' ),
admin_url( "css/colors/coffee/colors$suffix.css" ),
array( '#46403c', '#59524c', '#c7a589', '#9ea476' ),
* Displays the URL of a WordPress admin CSS file.
* @see WP_Styles::_css_href() and its {@see 'style_loader_src'} filter.
* @param string $file file relative to wp-admin/ without its ".css" extension.
function wp_admin_css_uri( $file = 'wp-admin' ) {
if ( defined( 'WP_INSTALLING' ) ) {
$_file = admin_url( "$file.css" );
$_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file );
* Filters the URI of a WordPress admin CSS file.
* @param string $_file Relative path to the file with query arguments attached.
* @param string $file Relative path to the file, minus its ".css" extension.
return apply_filters( 'wp_admin_css_uri', $_file, $file );
* Enqueues or directly prints a stylesheet link to the specified CSS file.
* "Intelligently" decides to enqueue or to print the CSS file. If the
* {@see 'wp_print_styles'} action has *not* yet been called, the CSS file will be
* enqueued. If the {@see 'wp_print_styles'} action has been called, the CSS link will
* be printed. Printing may be forced by passing true as the $force_echo
* For backward compatibility with WordPress 2.3 calling method: If the $file
* (first) parameter does not correspond to a registered CSS file, we assume
* $file is a file relative to wp-admin/ without its ".css" extension. A
* stylesheet link to that generated URL is printed.
* @param string $file Optional. Style handle name or file name (without ".css" extension) relative
* to wp-admin/. Defaults to 'wp-admin'.
* @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
// For backward compatibility.
$handle = str_starts_with( $file, 'css/' ) ? substr( $file, 4 ) : $file;
if ( wp_styles()->query( $handle ) ) {
if ( $force_echo || did_action( 'wp_print_styles' ) ) {
// We already printed the style queue. Print this one immediately.
wp_print_styles( $handle );
wp_enqueue_style( $handle );
$stylesheet_link = sprintf(
"<link rel='stylesheet' href='%s' type='text/css' />\n",
esc_url( wp_admin_css_uri( $file ) )
* Filters the stylesheet link to the specified CSS file.
* If the site is set to display right-to-left, the RTL stylesheet link
* @param string $stylesheet_link HTML link element for the stylesheet.
* @param string $file Style handle name or filename (without ".css" extension)
* relative to wp-admin/. Defaults to 'wp-admin'.
echo apply_filters( 'wp_admin_css', $stylesheet_link, $file );
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$rtl_stylesheet_link = sprintf(
"<link rel='stylesheet' href='%s' type='text/css' />\n",
esc_url( wp_admin_css_uri( "$file-rtl" ) )
/** This filter is documented in wp-includes/general-template.php */
echo apply_filters( 'wp_admin_css', $rtl_stylesheet_link, "$file-rtl" );
* Enqueues the default ThickBox js and css.
* If any of the settings need to be changed, this can be done with another js
* file similar to media-upload.js. That file should
* require array('thickbox') to ensure it is loaded after.
function add_thickbox() {
wp_enqueue_script( 'thickbox' );
wp_enqueue_style( 'thickbox' );
if ( is_network_admin() ) {
add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
* Displays the XHTML generator that is generated on the wp_head hook.
function wp_generator() {
* Filters the output of the XHTML generator tag.
* @param string $generator_type The XHTML generator.
the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
* Displays the generator XML or Comment for RSS, ATOM, etc.
* Returns the correct generator type for the requested output format. Allows
* for a plugin to filter generators overall the {@see 'the_generator'} filter.
* @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
function the_generator( $type ) {
* Filters the output of the XHTML generator tag for display.
* @param string $generator_type The generator output.
* @param string $type The type of generator to output. Accepts 'html',
* 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.
echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "\n";
* Creates the generator XML or Comment for RSS, ATOM, etc.
* Returns the correct generator type for the requested output format. Allows
* for a plugin to filter generators on an individual basis using the
* {@see 'get_the_generator_$type'} filter.
* @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
* @return string|void The HTML content for the generator.
function get_the_generator( $type = '' ) {
$current_filter = current_filter();
if ( empty( $current_filter ) ) {