[wp-trac] [WordPress Trac] #9460: Add custom_url_func to be run in template-loader.php

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 4 22:48:30 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  
--------------------------+-------------------------------------------------
 This is a follow-on from Ticket #9455 where the #9455 attempted to resolve
 one issue using a shortcut but the shortcut turned out to cause
 undesirable side effects and also did not address the fact that 404 and
 noncache headers had already been set.

 So this ticket provides a patch that will allow for a custom_url_func to
 be called at the beginning of template-loader.php. The custom_url_func can
 be set in a 'parse_query' hook using code that looks like this for the URL
 "/foobar/":


 {{{

    add_action('parse_query','my_parse_query');
    function my_parse_query() {
       if ($_SERVER['REQUEST_URI']=='/foobar/')
         set_custom_url_func('my_foobar_func');
    }
    function my_foobar_func() {
       echo 'Hello FooBar!  Bye.';
    }

 }}}


 Granted, this might not be the best way to accomplish this. For example,
 using a new filter might be a better way to accomplish this but I was
 trying not to add additional filter processing overhead assuming that
 might be a concern. I'm not attached to this particular solution, I just
 want to be able to get proper control of custom URLs that don't fit any of
 the existing patterns that have been baked into WordPress core and ideally
 I don't want it to have to be uber-complex for the plugin or theme
 developer either.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9460>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list