WordPress.org

Make WordPress Core

Ticket #11878: 11878.2.patch

File 11878.2.patch, 436 bytes (added by scribu, 6 years ago)

First check $post_id, then get post

  • wp-includes/post-template.php

     
    304304 * @return array Array of classes. 
    305305 */ 
    306306function get_post_class( $class = '', $post_id = null ) { 
     307        if ( is_null($post_id) ) 
     308                $post_id = get_the_ID(); 
     309 
    307310        $post = get_post($post_id); 
    308311 
    309312        $classes = array();