Skip to content

Commit a99f57b

Browse files
Coding Standards: Remove unnecessary conditional from do_trackbacks().
The check for a truthy `$to_ping` value is redundant, as a falsey value would cause the function to return early a few lines above. Follow-up to [1794], [2612]. Props justlevine. See #63268. git-svn-id: https://develop.svn.wordpress.org/trunk@60406 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d6355dc commit a99f57b

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/wp-includes/comment.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,22 +3060,19 @@ function do_trackbacks( $post ) {
30603060
$post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
30613061
$post_title = strip_tags( $post_title );
30623062

3063-
if ( $to_ping ) {
3064-
foreach ( (array) $to_ping as $tb_ping ) {
3065-
$tb_ping = trim( $tb_ping );
3066-
if ( ! in_array( $tb_ping, $pinged, true ) ) {
3067-
trackback( $tb_ping, $post_title, $excerpt, $post->ID );
3068-
$pinged[] = $tb_ping;
3069-
} else {
3070-
$wpdb->query(
3071-
$wpdb->prepare(
3072-
"UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s,
3073-
'')) WHERE ID = %d",
3074-
$tb_ping,
3075-
$post->ID
3076-
)
3077-
);
3078-
}
3063+
foreach ( (array) $to_ping as $tb_ping ) {
3064+
$tb_ping = trim( $tb_ping );
3065+
if ( ! in_array( $tb_ping, $pinged, true ) ) {
3066+
trackback( $tb_ping, $post_title, $excerpt, $post->ID );
3067+
$pinged[] = $tb_ping;
3068+
} else {
3069+
$wpdb->query(
3070+
$wpdb->prepare(
3071+
"UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d",
3072+
$tb_ping,
3073+
$post->ID
3074+
)
3075+
);
30793076
}
30803077
}
30813078
}

0 commit comments

Comments
 (0)