WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to embed links to the archive pages with specific search criteria. i.e Links to specific categories, links to specific authors etc etc

At the moment I am adding the links using anchor tags, but these will fail if the permalinks change

share|improve this question
up vote 1 down vote accepted

WordPress can generate these, so you can too. You would need to use the same function that WordPress does.

For category it would be something like:

$category =  get_category_by_slug( 'example' );
$link = get_category_link( $category->term_id );

Similarly there is get_tag_link() and on deeper level they all really use get_term_link()

I didn't play much with authors, but there is the_author_posts_link() and probably some get_ analogue.

share|improve this answer

Category archives, author archives, date archives, etc will not experience permalink changes. If you're using pretty permalinks, http://yourblog.com/category/my-cool-category will always present you with a list of posts from my-cool-category. Likewise, http://yourblog.com/author/mildfuzz will always present you with a list of posts published by mildfuzz.

The only tricky part is if you want to display other information on the archive page (like an author bit for an author archive) ... but there are tutorials available for that kind of work.

share|improve this answer
You can change base for tags and categories in permalink settings. It's rarely used, but the option is there and they can get changed. – Rarst Oct 4 '10 at 14:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.