From 3f7ac3eb4dea7e0eefd1c55edf8c11eb9bdbeac8 Mon Sep 17 00:00:00 2001 From: rboren Date: Sat, 14 Aug 2004 17:29:09 +0000 Subject: [PATCH] Complete support for %author% in post permalinks. git-svn-id: http://svn.automattic.com/wordpress/trunk@1534 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template-functions-links.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 6e6c49f6b0..f514133a9a 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -40,11 +40,12 @@ function get_permalink($id=false) { '%postname%', '%post_id%', '%category%', + '%author%', '%pagename%' ); if ($id) { - $idpost = $wpdb->get_row("SELECT ID, post_date, post_name, post_status FROM $wpdb->posts WHERE ID = $id"); + $idpost = $wpdb->get_row("SELECT ID, post_date, post_name, post_status, post_author FROM $wpdb->posts WHERE ID = $id"); } else { $idpost = $post; } @@ -60,6 +61,8 @@ function get_permalink($id=false) { $cats = get_the_category($idpost->ID); $category = $cats[0]->category_nicename; + $authordata = get_userdata($idpost->post_author); + $author = $authordata->user_nicename; $rewritereplace = array( date('Y', $unixtime), @@ -71,6 +74,7 @@ function get_permalink($id=false) { $idpost->post_name, $idpost->ID, $category, + $author, $idpost->post_name, ); return get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink);