Make WordPress Core

Opened 12 years ago

Closed 8 years ago

#18386 closed defect (bug) (worksforme)

Bug in custom query when "Front page displays": "A static page"

Reported by: cyberspy's profile CyberSpy Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Query Keywords:
Focuses: Cc:

Description

Here is the bug I have found:
When Front page displays is set to: A static page
and Blog posts are displayed on other page a bug accours...

Lets prepare test enviroment, with clear wp installation and two posts, where one of them is set to default category, and other is set to newly created category (which defautly has ID = 3).
Now, prepare two pages, and in Setting -> Reading set Front page to one of those pages, and Posts page to second one.

If You would like to exclude posts from category no 3 from main blog index, normaly You would use:
<?php query_posts($query_string . '&cat=-3'); ?> in index.php (or specified loop file linked there).
This would work if blog index is set as home page, but fails to work when above test enviroment is used.

Attachments (1)

18386.patch (1.6 KB) - added by dd32 12 years ago.

Download all attachments as: .zip

Change History (12)

#1 @dd32
12 years ago

  • Keywords has-patch added

Confirmed. Taxonomy Queries are not processed when page_for_posts is set; As a result, the category exclusion code is never run causing query_posts to not be effective not work as expected..

Attached patch deals with the taxonomy side of things, however Author specification and a few other things might also be affected (those in the else branch here: Line 1467 of query.php)

(note: I havn't tested any side effects of the patch, I'm hoping someone who feels like digging into WP_Query will take it and run :))

@dd32
12 years ago

#2 @CyberSpy
12 years ago

Thanks for reply and patch. Could You explain, what tools can be used to easily apply this patch to local version(Ps/Mac) beside normal file editing?
After patching will try do do some testing.

#3 @CyberSpy
12 years ago

Ok, I have managed to apply patch in Aptana.
dd32 -> Your's patch seems to work ok on test environment acting as one of my blogs. Now I'll try to appply it to working blog, and will check, if everything seems ok.

#4 @CyberSpy
12 years ago

  • Keywords needs-testing added

#5 @CyberSpy
12 years ago

I have tested the patch and no futher problems have been found.
Thank You dd32

#6 @CyberSpy
11 years ago

  • Version changed from 3.2.1 to 3.3.2

Sadly the bug is still here.
Could anybody take look at it again, and prepare working patch, and also submit it to someone, who will know what to do with it, so it can be added reviewed and added to next milestone?

#7 @CyberSpy
11 years ago

Ups, the patch is still working ok, so the only question is, how to submit this solution to be approved and added to next WP version?

#8 @SergeyBiryukov
11 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 3.3.2 to 3.2.1

Version number indicates when the bug was initially introduced/reported.

#9 @dd32
11 years ago

  • Keywords needs-patch added; has-patch removed

moving back to needs-patch since this patch will definately have unintended side effects, there would have to be a better way than this.

#10 @oso96_2000
9 years ago

  • Keywords reporter-feedback close added; needs-unit-tests needs-patch removed

I think this one is fixed? I wasn't able to reproduce it.

#11 @chriscct7
8 years ago

  • Keywords dev-feedback needs-testing reporter-feedback close removed
  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Unable to reproduce this and no additional reports in 3 years. Closing as worksforme

Note: See TracTickets for help on using tickets.