Make WordPress Core


Ignore:
Timestamp:
07/11/2025 01:14:57 PM (10 days ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Remove redundant checks in wp_resolve_numeric_slug_conflicts().

This commit removes two unnecessary conditional checks:

  • A truthy check for $compare, as a falsey value causes an earlier return a few lines above.
  • A check to ensure $maybe_page is not an empty string, as it is already cast to an integer.

Follow-up to [32648], [34492], [53857].

Props justlevine.
See #63268.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rewrite.php

    r59059 r60447  
    413413    // This is the potentially clashing slug.
    414414    $value = '';
    415     if ( $compare && array_key_exists( $compare, $query_vars ) ) {
     415    if ( array_key_exists( $compare, $query_vars ) ) {
    416416        $value = $query_vars[ $compare ];
    417417    }
     
    461461
    462462    // If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage.
    463     if ( '' !== $maybe_page ) {
    464         $query_vars['page'] = (int) $maybe_page;
    465     }
     463    $query_vars['page'] = $maybe_page;
    466464
    467465    // Next, unset autodetected date-related query vars.
Note: See TracChangeset for help on using the changeset viewer.