Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#11878 closed defect (bug) (fixed)

Null value passed to apply_filters when get_post_class() is called without parameters.

Reported by: utkarsh's profile Utkarsh Owned by: nacin's profile nacin
Milestone: 3.0 Priority: low
Severity: minor Version: 2.9
Component: General Keywords: has-patch
Focuses: Cc:

Description

If post_class is called without a post_id, null value is passed to apply_filters as the post_id, instead of the ID of the current post.

Attachments (2)

11878.patch (383 bytes) - added by Utkarsh 15 years ago.
Patch
11878.2.patch (436 bytes) - added by scribu 15 years ago.
First check $post_id, then get post

Download all attachments as: .zip

Change History (6)

@Utkarsh
15 years ago

Patch

#1 @Utkarsh
15 years ago

  • Keywords has-patch added

@scribu
15 years ago

First check $post_id, then get post

#2 @scribu
15 years ago

In 11878.2.patch I've moved the is_null() check before retrieving the post.

#3 @nacin
15 years ago

  • Owner set to nacin
  • Status changed from new to accepted

It looks like we should just change $post_id to $post->ID in the filter.

#4 @nacin
15 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [13462]) Pass post ID to post_class filter, even when calling post_class() without parameters in the loop. fixes #11878

Note: See TracTickets for help on using tickets.