[wp-trac] [WordPress Trac] #10786: Implementation of %my_taxonomy% in permastructs is incomplete
WordPress Trac
wp-trac at lists.automattic.com
Wed Sep 30 08:52:53 UTC 2009
#10786: Implementation of %my_taxonomy% in permastructs is incomplete
--------------------------+-------------------------------------------------
Reporter: johnbillion | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.9
Component: Permalinks | Version: 2.9
Severity: minor | Keywords: has-patch commit dev-feedback
--------------------------+-------------------------------------------------
Comment(by dd32):
> Is there some way we can do this without importing the chief annoyance
of %category%, namely that the category chosen is always just the one with
the smallest ID?
Only by adding a filter that says "This is the preferred term for this
taxonomy"
> And can we avoid adding the overhead of looping through all taxonomies
per given post type,
No. You need to loop through the taxonomy list to determine which items
exist within the current structure, We could cache that value however, But
seems pointless caching it when realistically, given that looping over
half a dozen tax's (under normal use) doesnt add much overhead..
> then retrieving all terms of that taxonomy for that post?
Caching data again..
> * Filter $rewritecode and $rewritereplace so plugins that want to employ
outre query tags in permalinks can do so easily.
WP_Query already supports it, This is purely get_permalink() permalink
creation which doesnt have it.
> * Add a property to a taxonomy that specifies that a post type can be
assigned only one term of that taxonomy.
Seems pointless, Better to just fall back onto a filter for preffered
ordering of the terms when used within a permalink IMO
> Add an argument to add_rewrite_tag() which puts that tag in the
$rewritecode pool.
The fact that a Rewrite arg is added says "I WANT to use this in
rewrites"..
In my opinion, You're looking at optimizing at the wrong layer. If you
want to prevent database lookups, an object cache should be used, There
needs to be qeries made to load required data once a page load, unless the
user choses to cache it. However the actual permalink itself could be
cached, which goes onto the "canonical permalinks" stuff. The ideal way to
prevent all the lookups would be:
{{{
get_permalink():
if ( has_post_meta('permalink') )
return post_meta('permalink', 'single'=true);
else
Generate permalink
update_post_meta
return $link;
on save_post / update_terms_for_post_$id / anything else
delete_post_meta('permalink')
OR
delete_post_meta('permalink') && get_permalink($id);
}}}
But thats for a different ticket maybe?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10786#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list