Coding Standards: Replace an empty foreach loop in wp_replace_in_html_tags().

This aims to clarify the intention of the code and improve readability.

Follow-up to [33359].

Props jrf, TobiasBg, mi5t4n, dhruvang21, mayura8991, nadimcse, Presskopp, SergeyBiryukov.
Fixes #61860.

git-svn-id: https://develop.svn.wordpress.org/trunk@58889 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2024-08-13 16:27:32 +00:00
parent 5f8f3789d1
commit 3476790c2e

View File

@ -762,8 +762,8 @@ function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
// Optimize when searching for one item.
if ( 1 === count( $replace_pairs ) ) {
// Extract $needle and $replace.
foreach ( $replace_pairs as $needle => $replace ) {
}
$needle = array_key_first( $replace_pairs );
$replace = $replace_pairs[ $needle ];
// Loop through delimiters (elements) only.
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {