[wp-trac] [WordPress Trac] #13068: Custom filters and actions for post_types rewrite urls

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 21 10:49:29 UTC 2010


#13068: Custom filters and actions for post_types rewrite urls
-----------------------------+----------------------------------------------
 Reporter:  butuzov          |       Owner:     
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  3.0
Component:  Post Types       |     Version:  3.0
 Severity:  normal           |    Keywords:     
-----------------------------+----------------------------------------------
 Hi.

 Can developers get a filter for
 '''{$args->rewrite['slug']}/%$post_type%''' ?
 and few do actions after?

 let me be clear.

 we (developers) can't change this rewrite's for custom needs, and we can't
 add after that custom variables.

 here is code that we have now.
 {{{
 if ( $args->hierarchical )
         $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)',
 $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
 else
         $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)',
 $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");

 $wp_rewrite->add_permastruct($post_type,
 "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'],
 $args->permalink_epmask);
 }}}

 its can be replaces by the code

 something like this

 {{{
 $wp_rewrite->add_rewrite_tag("%$post_type%",
         $args->hierarchical ? '(.+?)' : '([^/]+)',
         $args->query_var ? "{$args->query_var}=" :
 "post_type=$post_type&name=");

 $wp_rewrite->add_permastruct($post_type,
         apply_filters("rewrite_base_custom_{$post_type}",
 "{$args->rewrite['slug']}/%$post_type%"),
         $args->rewrite['with_front'],
         $args->permalink_epmask);

 do_actions("rewrite_base_custom_actions_{$post_type}");
 }}}

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


More information about the wp-trac mailing list