[wp-hackers] pre_get_posts problem

Mike Schinkel mikeschinkel at newclarity.net
Sun Jul 25 15:20:04 UTC 2010


Dion,

Thanks for answering.

On Jul 24, 2010, at 4:32 AM, Dion Hulse (dd32) wrote:
> One of the problems I feel, is that those who understand some of these problems, are not the ones being asked to achieve the goal, And if they are, they don't realise that other people may need to do the same thing themselves.

Suggestions on how to solve that maybe?

> At the same time, Comes times where you attempt something that no-one else has, and there simply isnt a filter for it.. Its going to happen sometimes

True, but pioneers are always those with arrows in their back, and that's unavoidable.  OTOH, it would help immensely if the cases well-known among those in the know could be better known.

> But with understanding comes blindness,

Very much agreed.

> I for example, would never even dream someone would use pre_get_posts to modify the front-end query, it screams of someone who doesnt have the foggiest of ideas on how the WordPress Query classes work; So its not something I would personally ever needed explaining, Unless it was asked of me, or i saw it being used incorrectly

Maybe that's a small part of the answer; encourage people who write about code solutions to tag them with something like "wpcodereview",  them, and then have them aggregate into one RSS feed?  Then the people who know could just monitor that feed and comment when they see things done wrong and/or write their own blog posts or update the codex when they get inspired to write because they identify a frequent anti-pattern or a particularly egregious error?  I find that its just a lot easier for most people to be reactive than proactive so maybe something like this could work?

> (And i often comment on a select few blogs I'm following for that reason, For example, This comment here: http://wpengineer.com/small-tips-using-wordpress-and-jquery/ - If anyone writes a blog with code excepts related to WordPress often, email me privately with the RSS feed and i'll post comments if I notice anything btw)
> 
> There is near nothing written on the Plugin/Theme upgraders for example, Ask me, and I can probably answer the query however; But I wouldn't know where to start writing for example, I wouldn't have a scenario which would require writing a howto on it.

Awesome.  After my current projects are cleared I plan to upgrade my blog and start writing again on all the things I've learned about WordPress, especially those things where I was able to find nothing written. I'll let you know.

> Mark has recently put a form up for people to ask him questions, each week he's been giving a answer to a select few questions: http://markjaquith.wordpress.com/ask-wordpress/ & http://en.wordpress.com/tag/ask-wordpress/ for the previous answers. That sort of thing is a great start IMO, And I'll do the same one day when I have the time for it.

It's a start. :)

> In the meantime, Developers shouldn't always trust code they find online, Sure, It says it achieves #1, but in actual fact, It does that whilst breaking #2, #3, and #4.. Always triple check what the codes hooking into....

Agreed. The big problem is how does the average WP coder ever know about #2, #3 and #4 (until after the problem surfaces?)

> I know i shouldn't have to say that, but there are far too many Copy-Pasters in the WordPress community as a whole, Many may be able to do it themselves, but trust that 3rd party code was tested correctly,

People copy & paste because it enables them to do things they couldn't do otherwise and that they have no way of achieving it on their own. They people don't understand the right way and never will (and I'm not being pejorative; most people using WordPress have expertise outside of WordPress and that's where the spend their time. Not everyone can or even wants to be a WordPress coding guru.)  So the more we as the community can present best practices the better.

> News for you, Often it isnt, and is written by a developer with less knowledge than you!

Well, not news for me. :) But agreed!



More information about the wp-hackers mailing list