A few lowercase words separated by dashes, describing a post and usually derived from the post title to create a user-friendly (that is readable and without confusing characters) permalink. Post slug substitutes the `%posttitle%` placeholder in a custom permalink structure. Post slug should not be ...

learn more… | top users | synonyms

11
votes
1answer
6k views

Is sanitize_title enough to generate post slugs?

I want to generate slug for some strings without going through WordPress slug generation flow. Therefore, I want to know which functions it calls to get a neat slug. I tried sanitize_title() but it ...
10
votes
3answers
4k views

Custom Post Type Slug / Page Slug Conflict - Prevent use of reserved slug on page save?

I have a custom post type of portfolio (slug portfolio) in my theme and all is working well except one thing. When people create a page with a slug of portfolio, eg: example.com/portfolio, the theme ...
8
votes
3answers
2k views

Is there a maximum slug length?

A client just created a post with a really long slug (90 characters), no special characters (other than hyphens) etc. Whenever the link to that post was clicked, including the "Preview" or "View this ...
8
votes
1answer
4k views

Redeclare/Change Slug of a Plugin's Custom Post Type

Is it possible to redeclare/change the slug of a plugin's existing custom post type (without simply editing the plugin)? That is, if Plugin X creates a custom post type with the slug /uncookedtoast/, ...
7
votes
1answer
3k views

custom taxonomy and pages rewrite slug conflict gives 404

I'm using the Custom Post Type UI plugin to create my custom taxonomies. I have a portfolio that is made up of projects (custom post type) with 2 custom taxonomies of technologies and clients. The ...
7
votes
1answer
387 views

Custom Post Types, slug, archive and SEO plugins

I made a custom post type called "friends". I am able to correctly list my friends using this urls: http://mysite/friends/friend1/ http://mysite/friends/friend2/ http://mysite/friends/friend3/ ...
6
votes
2answers
2k views

How to prevent apostrophes and quotes from appearing in permalinks?

I'm using custom permalinks "/%category%/%postname%/". Whenever a post title contains quotes or apostrophes they appear in the URL. Can someone tell me how prevent them from appearing in the slug? ...
5
votes
4answers
4k views

Theme localization of “slugs” (custom post types, taxonomies)

in my theme I want to define a series of custom post types and custom taxonomies, each one having its own customized slug; the base language of my theme is english, therefore the slugs will be in ...
5
votes
2answers
4k views

Change the “page” slug in pagination

Simple question. When pagination is activated, the URL changes to "site.com/page/2". For my site, this should be "site.com/paggetto/2". How can I change that rewrite rule? I also want to change ...
5
votes
1answer
751 views

How can I find plugins' slug?

I'm wondering how can I find plugins' slug (slug = internal name used by WordPress to do plugin updates and to determine which plugins are currently active)? It is usually plugin's folder name but if ...
5
votes
1answer
4k views

Rename files during upload using variables

I'd like to rename files during upload and set their names to the post slug the files are being attached to, plus some random characters (a simple incremental counter will de just fine) to make the ...
5
votes
1answer
3k views

custom slug for custom post type

Hi and thanks for reading. I want to insert the post author into my custom post type slug. Example: http://example.com/charts/%author%/ Any ideas how to accomplish this? Here is my custom post ...
5
votes
4answers
2k views

Removing Metabox for “Slug” without removing functionality

Here is an interesting question. I have recently noticed that if you utilize the code remove_meta_box('slugdiv', 'post', 'normal'); you are actually unable to modify the slug when you click on ...
5
votes
3answers
1k views

Regenerate slugs from title of posts

is it possible to regenerate the slugs programmatically after changing the titles of the post? The girl that updated the title of more than 200 posts just "forgot" to update the slug too, so i was ...
5
votes
1answer
3k views

Change Author Base Slug for different Roles

is it possible to change the author base slug in dependency of the role? For example, authors get example.com/ninja/%username% and subscribers get example.com/trainee/%username% ? I am thinking of ...
5
votes
3answers
388 views

Prevent Wordpress from abbreviating-long-slugs…-in-the-admin

On post edit pages, when a slug exceeds a certain number of characters, Wordpress abridges it with an ellipsis (...). For example, if my slug is i-want-to-be-able-to-see-this-slug, it appears on the ...
5
votes
4answers
136 views

Post type child of another post type

This may be a stupid question but is it possible to have a post type child of another post type? Let me explain with an example: I created 2 post types, "Actors" and "Galleries". What i want is to ...
4
votes
3answers
25k views

How to retrieve the slug of current page?

I am trying to retrieve the slug of the current wordpress page outside the loop. The title of the page returns with wp_title () but how can I get the slug? <li><a ...
4
votes
3answers
12k views

Get page content using slug

I'm trying to get page content when I only know the slug string. Is there a function for this, or an easy way to do this or is this a case of doing it via SQL? Thanks very much
4
votes
1answer
11k views

How to get a taxonomy term name by the slug?

If I know a taxonomy term slug, how can I get that term's name?
4
votes
2answers
5k 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
1answer
144 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
1answer
93 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
2answers
236 views

How to seamlessly redirect between different archive and singular slugs?

I have a CPT with slug function (singular) and archive slug functions (plural). Permalink structure for: singular is /function/[postname]/ archive is /functions/[page-x/]. (can poke live at ...
4
votes
1answer
383 views

Display posts with author in the url with custom post types

I'm having a really difficult time with this. I have a multi-user gallery site. Each author has his own page that lists the author's posts (this is a custom post type). I have made it so that the ...
4
votes
1answer
1k views

Using Custom Fields in Custom Post Type URL

I'm developing a car site that has showrooms. Each showroom needs it's own custom URL based on it's location. The location (City and County/State) is already inserted as two custom fields. So for ...
4
votes
3answers
852 views

Natural URL Design and static front page

A static front page and other pages which are children of it are used on a blog. To give an example: www.example.com The slug for that page shows up in the permalink for sub pages like ...
4
votes
1answer
271 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 ...
3
votes
4answers
3k views

Force post slug to be auto generated from title on save

I'm running a property site where many properties are sold in apartment blocks. Because of this what the content editors do is create a post/property with all the details and then use a duplicate ...
3
votes
3answers
4k views

How do I get a post (page or CPT) ID from a title or slug?

I've scoured the Codex, failed to get get_page_by_title() to work and am quite surprised that there doesn't seem to be a standard WP function for this task. I need to get the ID of any given post/ ...
3
votes
1answer
237 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
1answer
876 views

Is It A Good Idea To Change Author Slug (user_nicename field) Directly In MySQL DB?

Searching for a how-to on changing author slug, I found two methods: Change the user_nicename field in the MySQL database of your WordPress site to whatever you want the slug to be. Changing the ...
3
votes
2answers
839 views

how to automatically generate random slug

I have tried to create a function that generate a random slug when a post is created. I am a bit worried that the function generates non unique strings as slugs. How can I solve this? The function ...
3
votes
3answers
816 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
2answers
1k views

Must slugs be unique?

Is it true that slugs must always be unique, regardless of the rest of the url, or if it's used by different post-types or taxonomies? For example, is it possible to have both of these urls? ...
3
votes
3answers
2k views

How to check if a slug exists?

I have a arbitrary string and want to check if a post with that slug string exists in the site. I tried to find a way to list all slugs, but can't find such a thing. Thanks
3
votes
2answers
10k views

Get post by page name or slug

I know this is very avant-garde, but bear with me. I've read that one is able to query a page by the page/post name or slug. I'm trying to do this because I need information from a page with a similar ...
3
votes
1answer
207 views

Editing the Number at the end of Page URLs / Editing Page Slugs

I am playing around with wordpress and a few plugins. Say I have something called "Shopping Cart" and I delete the page. Then I recreate it, I can't have the old URL back. I get ...
3
votes
4answers
2k views

Can I use a number for a post/page slug?

Is it possible to use a number for a post/page slug? I have tried to use e.g. '123' for my page slug, but each time WordPress converts it to '123-2'. I'm guessing that any number is perhaps ...
3
votes
1answer
64 views

which is the function that removes accented vowels?

Which is the function WP uses to convert words like "voilà" and "novità" to "voila" and "novita" in category slug? Can I recall it in my theme?
3
votes
1answer
716 views

Slugs as breadcrumbs for Pages

I´m trying to create a function that creates a breadcrumb trail of Page slugs outside of The Loop. These breadcrumbs show the path from the homepage to the current (sub)page. For example, on the ...
3
votes
1answer
2k views

Remove taxonomy base or term from url

I know there are a lot of posts about this here, but NONE of them have answered my problem. I am working with a custom built theme that has a custom category type (named messagetypes). I have a ...
3
votes
1answer
79 views

Determining Slug Before and After Edit

If I were to edit a post or a page, how would I determine what the slug was before the edit, and again afterwards to compare them and see if it was changed? Also, would the same method work for any ...
3
votes
1answer
128 views

Rewrite category slug

I have some categories like so: /europe/postname /usa/postname For various reasons I would like to rewrite these to be: /news/view/postname I've tried a few re-direct plugins but not had any ...
3
votes
1answer
116 views

Prepend meta_value to permalink of post

I have 2 custom post types movies (non-hierarchical) and series(hierarchical). Each post from seriestype has a meta field _movie which contains a movie ID. I want to specify a custom permalink ...
3
votes
2answers
213 views

How to modify author base slug with groups and slug to use nice_nickname?

After reading the following suggestions from Jan Fabry regarding URL rewrite and the author slug I took the challenge in combining both solution in one. Change author base slug for different roles ...
3
votes
1answer
413 views

Custom Post Type - Same Post Name, Different Post Type

I have 4 Custom Post Types: Services FAQs Prices Before and After I want to be able to have the same post names within each of these post types, example: Services Skin ...
3
votes
1answer
380 views

Limiting the number of words or characters in the slug/permalink

Limiting the number of words or characters in Wordpress slug/permalink. I would like to limit the number to the first 5 words (or 20 characters) even if the post title is longer. example: Title: ...
3
votes
1answer
864 views

The same slug in multiple taxonomies

We have a project that uses several custom taxonomies, and we're finding that the client wants to add the same term in several of them. While the first slug for Foo may be foo, subsequent copies of ...
3
votes
1answer
509 views

Stop Wordpress Redirection From /keyword to /some-post-containing-keyword/

I have tried everything I've found. I can't stop webhostingbreak.com/ipage/ from redirecting to webhostingbreak.com/hosting-directory/ipage-hosting/ I tried remove_filter('template_redirect', ...