[wp-trac] Re: [WordPress Trac] #9460: Add custom_url_func to be run
in template-loader.php
WordPress Trac
wp-trac at lists.automattic.com
Sun Apr 5 01:16:21 GMT 2009
#9460: Add custom_url_func to be run in template-loader.php
--------------------------+-------------------------------------------------
Reporter: mikeschinkel | Owner: mikeschinkel
Type: enhancement | Status: new
Priority: normal | Milestone: Unassigned
Component: Permalinks | Version: 2.8
Severity: normal | Keywords: custom url
--------------------------+-------------------------------------------------
Comment(by mikeschinkel):
Replying to [comment:1 DD32]:
> Looking at the example, I'd do that with WP_Rewrite and a custom query
var myself.
>
> I think what would be better is a simpler way to manage endpoints and
startpoints in the rewriting code, for many people (esp. new people to
WordPress) its a real maze..
>
> I've got this old example code (which was for 2.2 i think, and doesnt
use any of the API functions) which shows something basicly similar to
what mike wants: http://dd32.id.au/files/wordpress/test-rewrite.php which
gave the url's: http://dd32.id.au/artist/
http://dd32.id.au/artist/artist-1/ etc. (Its old example code, it doesnt
work anymore, It needs to be changed to insert the rewrite rules at the
start rather than the end, since WP 2.5+? included some greedy matching
rules)
Yes, you are headed down the right path in terms of understand what I'm
trying to accomplish. However, the WP_Rewrite() ends up being a black art
because so few theme authors (and probably few plugin authors) really
understand how to write RegEx. I can do it but I kringe every time I have
to.
That said, making the WP_Rewrite() rules easier to use is really a much
bigger project and not one I'd one to take on w/o having a much better
understanding of what the community would accept. For example, I could
envision a URL templating system that would be much easier to understand
for themers, something like the following however that would potentially
be very complex to implement all edge cases:
{{{
$wp_rewrite->url_templates = array(
'/artist/{artist}/' => 'do_artist_page'
}
function do_artist_page($artist) {
// Generate the artist page here.
}
}}}
The solution proposed in my patch was instead an "escape valve" solution;
it's not architected like WP_Rewrite() but it would give themers and
possibly plugin developers a way to break out and just get some work done.
As is to create pages based on custom URL structures is overwhelmingly
complicated when WordPress is supposed to be easy. This was a roadblock we
hit again and again on my last project and one I'm hiting on my current
project.
So I guess the question is, what's the downside of implementing (something
like) the "escape valve" shown? It would not preclude a more fully
architected solution in the future and would let me (and others) get work
done, today. (BTW, another probably better option would be to add a new
"custom_url" filter instead of using the "parse_query" filter and a
$wp_query instance variable and set of functions. I can work that up if
that would be preferred.)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9460#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list