Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [slug]

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 changed and is especially useful if the post title tends to be long or changes frequently.

0
votes
2answers
20 views

Disable WordPress Archive Conflict Check

I want to have numerical slugs in WordPress for pages but WordPress doesn't allow this by default in an attempt to preserve the slugs for use by chronological archives. The wp_unique_post_slug ...
0
votes
0answers
16 views

Link of cpt error when I have duplicate post titles

I have a problem. when I have duplicate post titles: Post 1 titles "Story" link: https://domain.com/story-1.htlm Post 2 titles "Story" link: https://domain.com/story-1-2.htlm and cpt name "chap", ...
0
votes
1answer
28 views

Add custom taxonomy terms to Wordpress menu dynamically & append #slug to url

I have a 2 part question. This is my first post here, so apologies if I am doing it wrong. I have a custom taxonomy (created with WP Toolset) called 'Author Categories'. What I need to have done is ...
0
votes
1answer
26 views

Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?

I have a custom post type called "equipment". I would like the permalink structure to be: example.com/equipment/%post_id%-slug I specifically want it to use a dash and not a slash (i.e. - "id-slug" ...
0
votes
0answers
11 views

Using decoded (non-latin) URL as a share link

I'm getting the non-latin WP permalink this way, to avoid ugly, long, encoded URL: $hebrew_url = rawurldecode(get_permalink()); And later, I'm using this URL in share popup: <div class="share-...
0
votes
0answers
23 views

Avoiding the -2 in slugs

so I have a little problem. I made a WordPress bilingual site with Polylang. Everything works fine, but there is a problem with the slugs. Many pages, although they're not in the same language, have ...
0
votes
1answer
13 views

Non-existent child page URLs redirects to the image attachment URL instead of throwing 404

Entering a child page that does not exist will redirect to the image attachment page, specifically, the image attachment with the same slug. Say, entering example.com/cars/volvo-car/ will redirect to ...
0
votes
0answers
5 views

Link URL jumps/skipps to a different slug

For some reason the page I´ve set navigation to lead to skipps and fint a similar slug to visit. i.e. Linked page url: mysite.no/rc2019/workshops on click it "skips" and loads mysite.no/rc2018/...
0
votes
1answer
25 views

Custom Post Type Advanced Slug

I've been searching for a little while now, and I'm not even sure if this is possible. I have a custom post type 'holidays', for the post, with a category taxonomy 'locations' to put the posts into. ...
0
votes
0answers
22 views

Modify term slug before saving

I had the same problem like in this Question. Terms like 'c', 'c++' and 'c#' are only saved once with 'c' as slug. Based on example #2 from the answer I built some code that works fine when creating a ...
1
vote
1answer
22 views

How to edit the slug/permalink in Gutenberg?

After updating to WordPress 5 and creating a new post, I can add a title, but how do I edit the slug or permalink?
0
votes
0answers
16 views

How can I change a media attachment URL/slug, so that I can use that slug for a page?

As in the title. Yoast is now installed so that all media page URLs redirect to the image itself, but how can I change that slug for the image? It's currently using the slug I'd like to use for a ...
1
vote
1answer
40 views

WordPress custom slug (endpoint) and compare all links

I work on the one i18n function. It will work with subdir. For example: eg.com/hello-world/en For this I'm support EP_ALL for the WP custom endpoints. function lang_add_endpoints(){ ...
0
votes
1answer
27 views

Custom post type with slug for plural (archive) and for single

I've been searching a way to have kind of "two" slugs for a custom post, let me give an example: www.mywebsite.com/articles/ or www.mywebsite.com/articles/page/2/ for the archive www.mywebsite.com/...
0
votes
1answer
41 views

How to allow different authors to use same post slug?

We have a multi-author WordPress site where different authors need the ability to use the same slug (post_name). Right now WordPress will append a -2 to the slug but how can we prevent WordPress from ...
0
votes
1answer
30 views

Output all terms slugs for a loop filter

I have created a filter on a custom post type loop using terms slugs just like that : <li><a href="#" data-filter=".<?php echo esc_attr( $cat->slug ); ?>"><?php echo esc_html( ...
1
vote
1answer
47 views

Nested Custom Post Type or Custom Post Type Parents?

I'm looking to create some functionality on my custom theme I'm not sure if I need to research nested CPT or CPT with a page parent. So my site will have two pages Cars & Bikes Each car & ...
1
vote
0answers
50 views

Duplicate category slugs from pages and posts

We are working in a new website and having issues with duplicate categories slugs from "posts" and "pages". We are trying to develop the same structure of this website: https://coconuts.co. We ...
0
votes
1answer
18 views

how do prevent wordpress from creating permalinks for media files

Could one please explain how can I prevent WordPress 4.9 from creating permalinks/slugs for Media files without the need of installing another plugin? It's also important that the solution won't get ...
1
vote
1answer
28 views

How to get the post name (slug) from the item ID when traversing the navbar?

I'm working on a filter for nav menu items, such as add_filter('wp_get_nav_menu_items','nav_items', 11, 3); function nav_items($items, $menu, $args) { foreach ($items as $item) { $slug_1 =...
0
votes
1answer
106 views

Removing CPT slug from URL results in 404 error for archive page

I have created a CPT with rewrite rules as follows: "rewrite" => array( "slug" => "/", "with_front" => false ), In the functions.php, I have added the following code: function ...
2
votes
1answer
89 views

Taxonomy page returns 404 page not found

I have a custom post type and one custom taxonomy registered for it. The custom post type is called "memory-cards" and the taxonomy is "lesson".For this taxonomy I have create two terms "english" and ...
0
votes
1answer
33 views

I've removed my /author/ slug but it clashes with new and existing pages. Any fixes?

I've successfully removed my author slug using this tutorial: https://wp-snippet.com/snippets/remove-author-prefix-from-slug/ so it's like website.com/author/cixxy to website.com/cixxy My question ...
0
votes
1answer
36 views

Display a custom slug in URL depending on user variable

Sorry if this has been asked - I haven't figured out how to search it in a way that leads me where I want to go. We have a client who wants a site built that represents four geographical areas and so ...
3
votes
1answer
293 views

How do I use the same post slug for different Categories?

I want to use the same post slug for different categories. Because I will have different projects with the same slug. I already have the post slug email. The second slug email becomes email-2, but I ...
0
votes
1answer
151 views

how to get category`s slug in WP_Query loop?

i use below code : //custom post = project //taxonomy = project-category $args = array( 'post_type' => 'project', ); $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() )...
1
vote
1answer
36 views

How to show posts with multiple tags on tag.php?

On my tag.php page, I want to show posts with multiple tags... I have something like this: mypage.com/tag/tag1+tag2+tag3/ $tags = get_queried_object()->slug; //returns only 'tag1' !! $args =...
2
votes
3answers
54 views

How I Can Use The Get Value as A Slug

in my single.php i took a data from one $_GET[] value and i'm using this like domain.com/example-slug/?holder=value The thing i want is domain.com/example-slug/value or domain.com/example-slug/...
3
votes
2answers
155 views

Why don't WordPress post slugs allow accents?

If you create a post whose title has an accent in it and some other unicode character in it, eg à 漢語 title thing, its slug (permalink) will become a-漢語-title-thing... ie, the à was converted into a ...
1
vote
1answer
34 views

Programmatically rewriting slug through functions.php but returns 404

I wanted to change the slug of a certain post type (in this case, article) into whatever a certain value in its custom field. I went to functions.php and put this code. function na_remove_slug( $...
0
votes
0answers
86 views

Remove base slug from custom taxonomy url

I have created a CPT and have removed its base url slug using the following code: /** * Removing Slug from CPT */ function remove_slug( $post_link, $post, $leavename ) { if ( 'cpt_slug' != $...
0
votes
1answer
44 views

Matching slug terms from one array to those in array of WP_Term objects to output term names

I'm using WordPress's get_terms to return an array of WP_Term objects containing the term_id, name, slug, etc. for the child terms of a given taxonomy. I've saved this array to $tax_terms. I have a ...
2
votes
1answer
353 views

Duplicate Category and Page URL loads Category instead of the Page

I have created a Category with the slug service, which has the permalink: https://example.com/service. and a Page with the link: https://example.com/service. In the Category service, there is a post ...
0
votes
1answer
104 views

Does WordPress automatically redirect url without parent slug?

I inherited admin duties for my organization's site. Ive noticed that if I enter a url with a child slug only (and drop the parent) it seems to redirect to the full url. Ex: www.example.com/child-...
0
votes
1answer
17 views

Change permalink incrementor into pseudo-subdirectory

how I can change permalink from www.mydomain.com/lyrics/title www.mydomain.com/lyrics/title-2 www.mydomain.com/lyrics/title-3 to www.mydomain.com/lyrics/1/title www.mydomain.com/lyrics/2/title ...
0
votes
0answers
16 views

Prevent user to publish article based on slug

I am looking for a plugin/code to fix wordpress slug issue. Current behavior is if we have an existing article ... example: /selling-a-computer/ And we create another article and give it the same ...
1
vote
1answer
882 views

How to rewrite slug of custom post type archive page

I have a CPT called "case-studies" and the slug of the archive page of this cpt is www.my-domain.com/case-studies and the slug of the ctp posts is www.my-domain.com/case-studies/case-study-name. Now, ...
1
vote
1answer
38 views

Create a custom php page and load it at a specific slug

I have this painful problem with a client. They need to load a feed from a remote endpoint into a page that fits their WordPress template design.. They also want to display the page at a particular ...
0
votes
1answer
864 views

Remove /product/ from url. I want only category name then product name

I have a site https://abc/product/accessories/beanie/ But I want this https://abc/accessories/beanie/ Mainly I have to remove /product/ (/shop/) from url. Using this I got right permalink but ...
0
votes
1answer
227 views

How to change a Wordpress term's slug before saving

We are using WP All Import to import product data from a CSV into WooCommerce. Everything works fine (great plugin!) but we have one problem: Two of our product attributes contain disallowed symbols: ...
0
votes
0answers
33 views

How to have theme auto add Slug to custom post type?

I AM A NEWBIE SO BARE WITH ME I have a wordpress movie them which i did some custom edits to and its working fine. But i am trying to automatically add slug (seasons & episode slug) to a custom ...
1
vote
0answers
68 views

Sort order by slug for looped child terms of custom taxonomy

I have page that displays multiple carousels that contains the posts for each child term of parent taxonomy: projects for the custom taxonomy: portfolio-categories for CPT: portfolios. When Portfolio ...
1
vote
1answer
71 views

Custom Post Type with Same Page URL

I have set up a page with the URL slug "announcements" I also have a custom post type with the rewrite set to the same name: 'rewrite' => array('slug' => 'announcements'), This all works fine....
3
votes
2answers
829 views

Exclude specific slug in 'get_terms'

I have a custom taxonomy "role" for my custom post type "People". When listing the roles, is there a way to exclude roles based on slug and not ID via get_terms function? I ask because I'm running ...
0
votes
1answer
223 views

Delete Redirect Slug For Specific Post

I have a couple of posts that are getting hammered by bots so I want to change the permalink slugs. However, when I do so WP redirects from the old to the new slug. I want the old slug to give a 404. ...
1
vote
0answers
97 views

Best way of removing emoji support from url / slug only

Couldn't find anything on the topic. I guess something could be done with the 'wp_unique_post_slug' filter but how would I go about just removing the emojis from the slug? I've tried all kinds of ...
0
votes
0answers
17 views

Use default permalink for custom post (and no slug) [duplicate]

I'v created a custom post type with this code : register_post_type('Villes', array( 'labels' => array( 'name' => __('Villes'), 'singular_name' => __('...
1
vote
1answer
15 views

Stop / prevent WordPress from updating permalinks of custom post type

I have a WordPress installation with a custom post type with a whole bunch of posts. These posts all have a unique permalink which is being generated by FileMaker and synced with WordPress. This ...
0
votes
0answers
34 views

Wordpress adding -2 to the slug of every new post

This is a weird one. I get that WordPress adds -2 to duplicate posts even if that post isn't in the trash and is stuck in the database. But, I am getting an error where every new post I create, if I ...
0
votes
0answers
20 views

How to make WordPress create a query based on a slug?

How to make WordPress create a query based on a slug ? For example I have my wordpress site url as http://example.com/. I want to generate a page based on the slug provided on the url. This is a ...