Which version are you using? I am using WordPress 2.9.2,had same issue, here is the patch for ‘wp-includes/link-template.php’
*** link-template.php 2009-12-14 05:09:55.000000000 -0500
--- link-template_patched.php 2010-06-21 14:29:24.000000000 -0400
***************
*** 88,93 ****
--- 88,94 ----
$leavename? '' : '%postname%',
'%post_id%',
'%category%',
+ '%tag%',
'%author%',
$leavename? '' : '%pagename%',
);
***************
*** 128,134 ****
--- 129,151 ----
$category = is_wp_error( $default_category ) ? '' : $default_category->slug;
}
}
+
+ if ( strpos($permalink, '%tag%') !== false ) {
+ $tags = get_the_tags($post->ID);
+
+ if ( $tags ) {
+ usort($tags, '_usort_terms_by_ID'); // order by ID
+ $tag = $tags[0]->slug;
+ }
+ // show default tag in permalinks, without
+ // having to assign it explicitly
+ if ( empty($tag) ) {
+ $default_tag = get_tag( get_option( 'default_category' ) );
+ $tag = is_wp_error( $default_tag ) ? '' : $default_tag->slug;
+ }
+ }
+
$author = '';
if ( strpos($permalink, '%author%') !== false ) {
$authordata = get_userdata($post->post_author);
***************
*** 147,152 ****
--- 164,170 ----
$post->post_name,
$post->ID,
$category,
+ $tag,
$author,
$post->post_name,
);
I’m on WordPress 2.9.2, thanks for the patch.
However, I wonder why this is not patched.
Shall I report the bug somewhere else ?
I had the same problem on wp2.9 and its still the same with wordpres 3.0.
I would also like to know if there is a reason for it.