Questions tagged [slug]

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

0
votes
0answers
34 views

How to create a standard WP Page that has the same url as an archive

I've tried to Google this but to no avail. I'm a newbie at programming but I can say I'm adept at configuring WP - pretty please, please bear with me. :) I have a CUSTOM_TAXONOMY that when viewed, ...
0
votes
0answers
18 views

Add custom taxonomy slug to URL of Custom Post Type

I have a Custom Post Type named "blog", and a Custom Taxonomy named "area" (both setup using the CPT UI plugin). I have also used below code to add the taxonomy slug in the url, so that standard WP ...
0
votes
1answer
30 views

How to assign a default/priority taxonomy to be shown in url in case two taxonomy items are selected

I have a custom taxonomy (ex. taxonomyfoo) created with CPT UI plugin and assigned this taxonomy to the standard wp post. I have also used below code to add the taxonomy slug in the url (%taxonomyfoo%...
0
votes
1answer
20 views

Custom Post Type not using correct page template

I've been having trouble lately in trying to figure out why this custom post type is not using the correct template file. The custom post type is called 'job' and it has a rewrite on it for the slug ...
0
votes
1answer
78 views

Rewrite CPT slug with two taxonomy slug instead of one

I have a post type location with 2 taxonomies in it - service & sector. Now, normally wordpress would show the permalink like - site_url/location/post_name I've made it work to show - site_url/...
0
votes
1answer
20 views

How to 301 redirect from url with post id to permalink with post name (slug)?

my posts have urls of two different types: one with post id and other with post slug: /post/789 /post/my-post-slug i'm doing this using: add_rewrite_rule( 'post/(\d+)/?', 'index.php?p=$...
-2
votes
1answer
46 views

Is there any point to using wp_unique_post_slug?

From what I can tell, wp_insert_post will automatically append a -# to your post slug. So why does wp_unique_post_slug exist? Is it just there for legacy purposes or is there still a good reason to ...
0
votes
0answers
19 views

Breaking a post into multiple subpages, each with a custom slug

I'm trying to break a single page into multiple subpages. Started out using <!--newpage--> html comments, but then decided to switch to a customized version of the multipage plugin. The basic ...
3
votes
2answers
80 views

Don't replace “|” with Empty String (“”) when generating slugs from title

I work for an architecture company and our project names mostly go like this: house|something, bridge|somewhere, building|whatever. Now, when I want to add a new project named like that, WordPress ...
0
votes
0answers
18 views

Does WPML have a JSON/REST API to retrieve slugs?

I'm migrating from QTranslate-X to WPML. The resulting redirect rules that were generated are wrong: they point to the English-version slugs rather than the French-version slugs. I therefore want to ...
0
votes
1answer
37 views

permalink not showing correctly using wp_insert_post and post_name

So I am using wp_insert_post() to create new posts dynamically. But I am trying to achieve the permalink structure to Parent/Child page as: Parent/Child/GChild or mydomain/MYTitle/1/1/ (yes I want ...
1
vote
0answers
38 views

Memberpress custom fields - filtering content

I'm working with MemberPress for a subscription site. The client requires an options within every plan to give the option to filter the content within their subscription based on a checkbox within ...
0
votes
0answers
16 views

How to manually archives and display posts of categories?

I'm trying to do the following steps, it will be a process of end of the year : The category "This year" has to be in the "Archives", the oldest archives has to be delete, and i had to re-create a ...
0
votes
1answer
41 views

Using the slug of a custom post category as prefix for the underlying custom post slugs

I'm currently using the Avada Theme that is making use of custom post types being Portfolio Categories & Portfolio Items (which are part of one or more categories). The theme is offering the ...
0
votes
1answer
22 views

How to enqueue a script on a specific URL that contains multiple parts

I've tried using is_page() to pass the URL to but the page I am trying to enqueue my script on is "races/community/add" and isn't a single slug like "about-us". Is it possible to do this with is_page()...
0
votes
1answer
36 views

404 error on published page with specific permalink

I am experiencing a strange error with my Wordpress install. I've got a dozen of pages, %postname% permalink structure, everything works fine. For one of the published pages, I reverted it to draft ...
0
votes
0answers
17 views

Wordpress not showing 404 when slug is wrong

I have a strange permalink structure : /%category%/news/%post_id%-%postname%.html And I use the plugin "WP No Category Base" It is working fine with one exception : When the "%postname%" part ...
0
votes
0answers
23 views

Wordpress doesn't respect Page slug in custom post type url pagination. Keeps getting removed

I have a custom post type, Company, with respective company child pages. Whenever I attempt to go to a page url eg. http://example.com/company/example_company/page/2, the /page/2/ gets striped from ...
0
votes
0answers
46 views

Allow duplicate slugs for custom post type with taxonomies

I have set up a custom post type (team) and a custom taxonomy (team_tax) for this post type, both with the same slug. Down to the core: register_post_type( 'team', array( 'labels' => ...
0
votes
0answers
36 views

underscore not allowed in role slug?

I created a role, 'CFI_G' in a plugin activator: if(!role_exists('cfi_g')){ add_role('cfi_g' , 'CFI-G', array('edit_gc_instruction')); } else { (note the underscore in the slug) It appeared to ...
0
votes
1answer
40 views

WooCommerce product id as permalink

Currently, the WooCommerce product permalinks is '/product/shoes-3' , '/product/cup-12' etc. How to change product permalinks to only be like /p/product_ID , for example '/p/1122' without using any ...
0
votes
0answers
37 views

Child pages with the same slug

I have an ecommerce website which is running on wordpress and the woocommerce plugin. I sell car accessories and I have some problems with the structure of the sub-category urls and slugs. I tried to ...
0
votes
1answer
30 views

List posts with slug title

The code is for single-product.php. I can list all products on page but I want to list all posts with slug titles. <?php $args= array( 'post_type' => 'products', 'order_by' ...
0
votes
1answer
26 views

I want to change the slugs of my terms dynamically

I'm looking to change my slugs dynamically so that they are displayed with the names of my terms, for that I created an option in the administrator panel that should allow me to start the process, but ...
0
votes
0answers
45 views

I'm trying to sanitize_title() the terms and display them correctly

Hi i'm looking for a track to make sure that for each terms of taxonomies: that I can make a sanitize_title () of the name of the term and correctly display the name of the term in the slug of each ...
0
votes
1answer
22 views

Change author base and slug in author link

Hello im trying to change the author link from mysite/author/username to mysite/companies/dataFromUserMetabox i tried the approach from this answer chage author url its working the url changed but ...
0
votes
1answer
37 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
24 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
33 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
50 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
36 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
24 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
19 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
31 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
29 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
86 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
24 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
52 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
191 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
43 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
34 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
87 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
96 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
34 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
40 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 =...
1
vote
1answer
474 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
264 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
37 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
48 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 ...