#15322 closed defect (bug) (fixed)
Skip category and tag queries on non posts in get_post_class()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Template | Version: | 3.1 |
| Severity: | normal | Keywords: | dev-feedback has-patch |
| Cc: |
Description
Where post_class() is used in a loop that iterates over an array of non-post objects get_post_class() will query for categories and tags regardless. Most times, these taxonomies are not registered with the post_type. This bug results in 2 additional queries per iteration. Please see attached (post-class-test.php) for an example using attachments.
Attachments (2)
Change History (10)
- Milestone changed from Awaiting Review to 3.1
Thanks for the fix. For future reference:
http://codex.wordpress.org/Reporting_Bugs#Patch_Writing_Guidelines
- Resolution set to fixed
- Status changed from new to closed
Scribu. No problem! Been trying to find ways to help out in here. What could I have been done better with the patch?
Well, the patch was made relative to the wp-includes folder, when it should have been made relative to the wp folder.
Less importantly, if( should have been if ( as per the coding standards.
I thought that might be the issue. I used Tortoise SVN to create the patch and there was not an option for anything like this. I have yet to use svn via the command line, but I can definitely learn.
Could you please explain how to do this?
I'll reread the coding standards.
I missed that bit before.
Unfortunately, there's no command line version of svn for Windows.
And I'm on Ubuntu, so I don't know how you should do it via TortoiseSVN.
mfields: Navigate to the site root, then right-click inside the directory (no file in particular), then create a patch from there. You'll get a diff relative to the root for all files modified.

How to reproduce