Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #53910, comment 8


Ignore:
Timestamp:
08/11/2021 12:36:48 AM (3 years ago)
Author:
costdev
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #53910, comment 8

    v2 v3  
    1919<?php
    2020    if ( have_posts() ) : while( have_posts() ) : the_post();
    21         if ( get_post_field( 'post_name', get_the_ID() ) === sanitize_title_with_dashes( get_the_title() ) ) {
    22             echo 'Yes';
    23         } else {
    24             echo 'No';
    25         }
     21        $slug = get_post_field( 'post_name', get_the_ID() );
     22        $sanitized_title = sanitize_title_with_dashes( get_the_title() );
     23        echo ( $slug === $sanitized_title ) ? 'Yes' : 'No';
    2624    endwhile; endif;
    2725?>