A permanent link to an item (a blog post, an attachment, ...). The default structure is "?p=123", but WordPress can handle "pretty permalinks" and will rewrite them internally to the former version. If you have a question about special rewrite structures you should use the [url-rewriting] tag.

learn more… | top users | synonyms (1)

4
votes
2answers
4k views

Wordpress slug issue with non-latin characters

I'm using permalinks in WP as: domain.com/category/post_name The issue is that post names have non-latin characters such as chinese, hebrew, and arabic. So it encodes them to something like: ...
4
votes
2answers
5k views

How to get permalink and title from post ID?

I have stored an array of post IDs and I would like to list the posts as links, meaning I need to get the title and permalink for the post ID - $id. The list should be echoed out by the following if ...
4
votes
1answer
122 views

When creating a WordPress page, a “-2” suffix is added to new pages' permalinks

I have noticed after deleting an original page in WordPress with lets say a permalink of your_domain.com/contact/ and then trying to recreate the same page with the same name/slug, my WP is generating ...
4
votes
2answers
529 views

the_title() and the_permalink() won't work on AJAX calls

I've run into a strange problem. I have a custom loop built with get_posts that works fine when loading the page normally: <?php $rows = get_posts(array( 'post_type' => ...
4
votes
1answer
86 views

How to i18n slugs for templates?

some templates are chosen from WordPress based on slugs (e.g. category-{slug}.php). Problem: How can I use the same template for an i18n'ed slug? Example: I have a category-news.php and an english ...
4
votes
1answer
882 views

Does WordPress automatically do 301 redirect if I change permalink

I don't know how to check this but it seems to do the redirection when I change the permalink structure.
4
votes
1answer
8k views

Rewriting a custom-post-type permalink with taxonomy term?

I'm trying to rewrite my url for a custom_post_type named wr_events with one of its custom_taxonomy terms from event_type add_action('init', 'wr_events'); function wr_events() { ...
4
votes
2answers
315 views

Minimal custom permalink structure

I'm aware that there are posts discussing this issue already (e.g. http://wordpress.stackexchange.com/questions/1364/what-is-the-best-permalink-structure-for-seo) but I have a specific set of ...
4
votes
1answer
83 views

Page permalink conflict with Date

I need to access a page which is name 2011. The trouble is that WP thinks that I am trying to read the 2011 posts of my blog. The only way I can make it work for the moment, is to change the ...
4
votes
1answer
1k views

Passing variables through permalink structure

I have a WordPress page which is accessible via /accommodation/. What I want to be able to do is pass in a parameter using the URL - ie going to /accommodation/value1/ would load the same page as ...
4
votes
5answers
2k views

Remove slug in taxonomy url

Just wondering, how can remove slugs from some URLS. I'm using a custom post type called exhibitors, and some taxonomies to define those exhibitors (eg: featured-guests, publishers etc.): Right now ...
4
votes
2answers
3k views

where is permalink info stored in database?

I see that I can edit permalink information in wp-admin page > settings > permalinks. However, where is that information actually stored in the database?
4
votes
1answer
575 views

Why does `get_permalink()` produces an add. DB request without $post->filter?

I'm currently working on a custom loop/query where I need to add the permalink of a post to the array of posts I'm retrieving from the DB. Sadly get_permalink() produces one additional DB request ...
4
votes
1answer
2k views

How do I set a custom base URL for standard posts?

Currently, permalinks are set to /%postname%/. I'd like to prefix "blog" before all standard posts. I'm using several custom post types, each with their own rewrite rules in the setup. How can I ...
4
votes
2answers
958 views

Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/

I made a site some time ago and after some days some posts were indexed by search engines. Today I changed the permalink structure from /%postname%/ to /%category%/%postname%/. After that, when ...
4
votes
1answer
626 views

WordPress search: pretty URLs (permalinks), custom post types and pagination

I have three separate search boxes on my website: species CPT search, glossary CPT search and a general search which I'd like to search post and species post types. My questions are threefold, ...
4
votes
1answer
583 views

Rewrite rule for Custom post type Monthly and Yearly archive

I have a custom post type "contest_recipe". I can view contest recipe posts by year and by date with the following urls: http://example.com/2011/?post_type=contest_recipe - shows all 2011 contest ...
4
votes
3answers
1k views

Using /%postname% for a custom post type

I have a custom post type whose permalink needs to sit in the same space as pages, like so: /an-example-thing <-- custom post type 'thing' /about-the-things <-- a normal page I'm well ...
4
votes
2answers
2k views

Filtering categories in the permalink structure

Using /%category%/%postname%/ for the permalink I get a URL string of all the categories that the specific post is included in. I would like the categories in the url to be filtered down to only one ...
4
votes
1answer
101 views

Pretty Permalinks

I've created my own search functionality which basically finds the nearest store closest to the entered postal code. My URL for the search currently looks like this ...
4
votes
6answers
4k views

Get the current page URL (including pagination)

Is there a WP function to automatically get the correct URL of the current page? Meaning if I just opened a single post, the function returns the same as get_permalink(), but if I'm on a paginated ...
4
votes
1answer
180 views

Permalinks so that one custom post type appears to be a child of another, not working

Currently I have two post types, "products" and "products-data" they are separate post types; however, for all intents and purposes products-data is a child post of products. The relation is ...
4
votes
1answer
254 views

Dynamic taxonomy in permalink made all other posts NOT FOUND?

I added my taxonomies in the permalink instead of the Custom Post Type's slug, and it works fine. I'd even say everything was working fine but changing the WP installation to Multisite broke all other ...
4
votes
3answers
523 views

How to add a custom URL placeholder to author archives?

I am working with a client who has a directory site that allows users to create accounts, then lists of items from the directory. Right now, whenever a user creates an account, she gets a profile URL ...
4
votes
1answer
143 views

Making %author% the rewrite slug for custom post type causes 404s on non CPTs

This has been driving me absolutely mad. I created a custom post type which I plan to use to create pretty affiliate/redirect links throughout my site. Here is my register_post_type(): ...
4
votes
1answer
1k views

Custom Post Type Archives by Date with Custom Permalink

I'm a bit stuck with getting the custom permalink for custom post type (CPT) archive to work. I've registered my 'press_release' CPT as following: add_action('init', 'press_release_post_type_init'); ...
3
votes
1answer
10k views

How to rewrite URI of custom post type?

The site that I am working on uses the following "pretty" permalink structure: http://example.com/blog/my-special-post But for a custom post type my client would like to avoid having a "pretty" ...
3
votes
3answers
2k views

Get page permalink without wpurl

I currently have an ID of a page that I want to use its permalink as the front of a permastruct of a CPT I'm setting up. Now I can use get_permalink() but that returns the full URL: ...
3
votes
2answers
585 views

Custom post types - Use post_id in permalink structure

I'm registering my CPT like so: $args = array( 'labels' => $labels, 'public' => true, 'hierarchical' => false, 'rewrite' => array( 'with_front' => false, ...
3
votes
3answers
2k views

Need help with friendly URL's in Wordpress

I'm creating som custom templates in Wordpress and I'm passing some data in the URL's. Currently my URL looks like this: http://www.mysite.com/designers/?id=43&name=designer+name The URL ...
3
votes
1answer
133 views

Slug Formatting : Acceptable Characters?

I have done a lot of googling on this so I sincerely apologize if there is a codex entry for this but for the life of me I can not find a hard and fast rule about what characters are acceptable in a ...
3
votes
2answers
2k views

Get Permalink without domain (i.e. get relative permalink)

This is the code I am using: <?php echo str_replace( home_url(), '', get_permalink($post->ID) ); ?> What it does is output the permalink as a relative URL i.e. only the slug. For instance, ...
3
votes
1answer
2k views

Pretty URL with add_query_var

I'm trying to add a 'sub post' to each post on my site, eg site.com/product-one/changelog site.com/product-two/changelog site.com/product-three/changelog This is the code I'm using atm, which I ...
3
votes
2answers
2k views

mod_rewrite enabled but Permalinks show index.php

I just installed a friends blog on my LAMP stack, which has mod_rewrite enabled (I'm using it for clean URLs on my Drupal installs on the same server). For some reason, WordPress (3.0.3) isn't ...
3
votes
1answer
1k views

Changing the URL Structure of a Paginated Custom Post

I have a custom post type for slideshows that creates a paginated post and each slide is a separate page. The data for each slide is saved in the custom fields and each slide has a title set saved in ...
3
votes
1answer
269 views

Is there an action for when permalinks are rebuilt?

In my plugin, I have a list of titles and permalinks in the options table. It's updated every time my custom post type is saved. Since I'm saving permalinks the option data can become bad if the ...
3
votes
3answers
742 views

How to control which category will be picked for the slug of a post?

I'm using the permalink structure "/%category%/%postname%/". What bothers me is that I have posts that belong to two categories. And of course, unfortunately, Wordpress always picks the wrong one for ...
3
votes
1answer
1k views

Custom post types - Use post_id in permalink structure when using has_archive => true

I recently asked this question Custom post types - Use post_id in permalink structure and solved it but as I have enabled 'has_archive' => true the solution given no longer works. Let me explain: ...
3
votes
2answers
643 views

How to get the clean permalink in a draft?

When I use the_permalink or get_the_permalink in a draft or scheduled post, the URL provided is not the "final" permalink—it is the unpretty ?p=xxxxx version. How can I get the final, "clean" ...
3
votes
1answer
2k views

“.#[random-char-string]” being inserted at end of URLs

I've seen this on a couple of sites now and I'm having trouble finding information about (probably because it's awkward to describe): All internal URLs like this for example: ...
3
votes
3answers
464 views

Custom permalinks

We have a custom type music. /music/ /music/post-name/ Also, we have a tag-like taxonomy genres. Its urls are: /music-genres/genre-name/ I'm trying to make urls like: /music/ /music/post-name/ ...
3
votes
1answer
284 views

Custom Permalink: /year/month/post-goes-here/?

I'm experimenting with adjusting permalinks (for purely educational experimentation). What would I need to place in the "Custom Permalink" option to get my post URLs in the form... ...
3
votes
2answers
406 views

How to custom change author base without $this->front?

I have a sample code: function change_author_permalinks() { global $wp_rewrite; $wp_rewrite->author_base = 'u'; $wp_rewrite->author_structure = "/" . $wp_rewrite->author_base . ...
3
votes
2answers
498 views

Can /%year%/%monthnum%/%day%/ structure tags be added to custom post type permalinks?

Just wondering if anyone had tried using any of the structure tags available to post permalinks with custom post types... I'm moving my "listings" posts on a site I manage from a category hack under ...
3
votes
2answers
1k views

Change author permalink

The original urls for users look like /author/login/ Is it possible to replace login by user's id? In my dream urls should become to /users/34/ (34 is user id). Thanks.
3
votes
1answer
4k views

Remove parent category from permalink? Basically only have the child category?

I think there used to be an out-dated plugin to do this. Is there any way to do this easily with just a little code? We prefer not to rely on a plugin since that makes us dependent on the developer ...
3
votes
5answers
198 views

Update URL Snippet to Canonical Permalink URL

My permalinks is in the format domain.com/post-id/post-slug I notice this is a great choice for permalinks as I can share articles with a short URL like domain.com/123 But when I go to this short ...
3
votes
2answers
269 views

CPT archive 404ing when using a custom taxonomy name as a variable

So, I'm using a custom post type archive and generating a JavaScript-based filtering interface for sorting through results. Here's an example: http://www.inverity.org/sermons/ Now, what I'd like to ...
3
votes
2answers
183 views

Understanding Permalinks on Custom Post Types

I hate to try to reinvent the wheel here, but none of the suggested post seem to work in answering my question. I am building a system for our 30 Under 30 honorees, which is basically setup as a ...
3
votes
2answers
508 views

Custom post type 404s with rewriting even after resetting permalinks

I created a custom post type, of which the (simplified) arguments are: register_post_type( 'Event', 'public' => true, 'rewrite' => array( 'slug' => 'eventy'), 'has_archive' ...