$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'
];
if ( $total < 2
) { return;
} $current =
(int) $args['current'
];
$end_size =
(int) $args['end_size'
]; // Out of bounds? Make it the default.
if ( $end_size < 1
) { $end_size = 1;
}