#13782 closed feature request (maybelater)
query_posts and strict boolean
| Reported by: | arena | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
when querying posts, wordpress discards any other filtering such as cat : for example, retrieve post p in category c => "?post=p&cat=c" is converted in "?post=p".
Adding a 'strict' boolean argument like "?post=p&cat=c&strict=1" to avoid any convertion of the query. strict default value would be 0 of course.
what do you think ?
Attachments (1)
Change History (11)
#2
@
16 years ago
The underlying issue is that WP parses query values eclectically. To make "strict" really work, you would first have to rewrite the query parsing algorithms into something that actually is strict in the sense of being general and consistent across query arguments. At that point you'd have a new, backwards-incompatible query parser.
"strict" might actually be a good way of transitioning to an improved query parsing engine while stepping around backwards-compatibility issues: those queries that don't specify it would use the old system.
#4
in reply to: ↑ 3
@
16 years ago
Replying to arena:
@filosofo,
i attached a sample patch
What I was trying to get at is that we shouldn't call it "strict" unless it's actually strict in a general, meaningful sense. If you just want an ad hoc solution to the particular problem, better to call it something more specific. Let's reserve "strict" for when we can actually make it strict.
So a more specific ad hoc solution would be, for example, to create a new query var called something like mandatory_cat which if called the given singular post must have.
query_posts(
array(
'p' => 123,
'mandatory_cat' => 456,
)
);
#5
@
16 years ago
strange ?! revision 15239 integrates the sample patch above (that is still a sample)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Feature Request combined with no patch leads to Future Release