WordPress.org

Make WordPress Core

Ticket #11331: 11331.diff

File 11331.diff, 556 bytes (added by coffee2code, 4 years ago)

Passes slug through sanitize_html_class()

  • wp-includes/post-template.php

     
    427427                $pageID = $wp_query->post->ID; 
    428428 
    429429                $classes[] = 'page-id-' . $pageID; 
     430                $classes[] = 'page-slug-' . sanitize_html_class( $wp_query->post->post_name, '' ); 
    430431 
    431432                if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) ) 
    432433                        $classes[] = 'page-parent';