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.

Filter by
Sorted by
Tagged with
2
votes
3answers
77 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
664 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
94 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
1answer
69 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
1k 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
374 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
20 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 ...
4
votes
1answer
4k 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 CPT posts is www.my-domain.com/case-studies/case-study-name. Now, ...
1
vote
1answer
173 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 ...
1
vote
1answer
2k 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
575 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: ...
1
vote
0answers
169 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
188 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
3k 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
566 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. ...
2
votes
0answers
179 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
21 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 ...
1
vote
1answer
478 views

Does rename of page slugs create 301 redirects from old slug to new (same as for posts)?

Does rename of page slugs create 301 redirects from old slug to new (same as for posts)? Starting a fresh install of wp wordpress:4.9.4-php7.1 I'm trying to get automatic redirects for renamed page ...
0
votes
1answer
24 views

Change the full slug for a specific category?

I have multiples categories on my post: /category/blog /category/sports …And so on. I also have /category/news I'd like to change this category url to simply have /news without the /category. How ...
0
votes
1answer
22 views

Wordpress numeric (yearly) page names / disable yearly archives

I need to achieve page structures on website that is http://pagename.example/2017, http://pagename.example/2018 .. etc Now wordpress rename my page slugs to 2017-2, 2018-2 because WP use those ...
0
votes
0answers
98 views

Can't use Persian/Farsi in Author slug (returns 404)

I have modified author links to show nickname instead of username, using this tutorial. It works correctly with English names, but when I use Persian, it returns a 404. What's wrong? I've also tried ...
0
votes
1answer
123 views

WordPress Reserved Terms, any workaround?

I noticed that "embed" is part of "reserved terms" so it automatically change my slug in embed-2. There is any solution to force it to "embed"?
0
votes
1answer
138 views

Exclude a category slug on pagination

I'm a beginner of wordpress ... I'm creating my first template and I would like to exclude the category "portfolio" from pagination. I tried in every way, but I managed to do just the opposite, browse ...
0
votes
0answers
154 views

fix slugs containing invalid characters?

On a site I support, there are a lot of urls containing seemingly invalid characters (e.g. brackets, commas etc) which cause 404s in Google. e.g. http://www.anorak.co.uk/167259/news/those_who_cant,...
0
votes
1answer
128 views

add .html to custom post type with WPML

( i open a new question since i found why my slug don't translate in generated links, sorry if it is an error, but sounds logical for me ). so i use WPML and Custom Posts Type on my wordpress. i ...
0
votes
3answers
443 views

How do I get slug of all active plugins programmatically?

I want to check plugin version using following API https://api.wordpress.org/stats/plugin/1.0/{slug} For that how can I get Slug of All Active Plugins ?
0
votes
1answer
1k views

Divi change project slug based on category

My first help-question here :) Using Divi theme, i found that Project custom post type let you add your portfolio projects, while having PROJECT slug in the URL. The web is full of tutorial about ...
0
votes
1answer
313 views

Automatically update slug with latest title within custom post type [duplicate]

I'm trying to update the slug for all the post within a specific custom post type, let's say "music". Here is the code: /* Update slug with the latest post title */ function auto_update_post_slug($...
1
vote
1answer
396 views

Using page slug in array

I want to use the page slug as the taxonomy when calling a list of custom posts. This works: <?php $page_slug = basename(get_permalink()); ?> <?php echo $page_slug; ?> It shows "...
0
votes
2answers
144 views

generate random slug when adding taxonomy

I have created a custom post type called 'reports' to provide an easy method for providing monthly reports to specific people. I don't want users to have to login to view the reports and I also don't ...
4
votes
1answer
6k views

Custom Post type & Taxonomy URL structure

I have a custom post type products and a custom taxonomy 'Product Categories' with the slug products. My goal: I'm trying to create a URL structure like so: Product Post Type Archive: products/ ...
0
votes
1answer
41 views

Slug Confusion Between Post and Custom Post types?

So I have a custom post type "Testimonial" and it's got some...interesting...behaviors. Last night, I had that type running and had created two testimonials, one of which was titled "James Blackwood."...
1
vote
0answers
511 views

Include parent and child in category url

I've seen a lot of questions like this, bot none that could solve my problem. For example: How to include parent terms in hierarchical taxonomy URLs? I've created a custom category with the ...
0
votes
1answer
39 views

Get category from slug list

I've a list of url's and I want to get the categories of each one. Whats the best way to achieve this? Thanks. Diego
1
vote
0answers
29 views

Add Custom Slug Tags Per Page

So I want to be able to have dynamic slugs for my Woocommerce "My Account" page, basically the current format is http://www.example.com/my-account/but I want to make the parent page the Buddypress ...
2
votes
2answers
3k views

Remove Slug from Custom Post Type results in 404

I am working on a plugin that creates lists. After creating a list, I wanted to remove the slug from the url Post type: $rewrite = [ 'slug' => 'single-link', 'with_front' =&...
1
vote
1answer
159 views

Do post_names have to be unique?

I'm not 100% sure about this, so I'm asking: Does a post's post_name (aka: a post slug) have to be unique? Do they also have to be unique if each post has a different post type (a post and an ...
0
votes
1answer
9k views

Get the Current Page Slug-Name

I want to Retrieve the Current Pagename , Inside my Breadcrumb , i tried many ways to get the idea work , but unfortunately they didn't work e.g : <?php wp_title('true'); ?> ...
0
votes
1answer
324 views

Slug collision between page, taxonomy and custom post type

I have a rare scenario where I need an advanced Rewrite URLs in order to retrieve the desired URL structure. Here's the thing. I have 3 separate items to manipulate with: Page Custom post type ...
0
votes
2answers
90 views

How to find a specific post_type using its “rewrite slug”?

I've been struggling with a quite specific point. I registered some custom post types and specified the rewrite slug for each one of them. 'rewrite' => array( 'slug' => 'my-slug' ), ...
1
vote
1answer
429 views

Change author slug and functionality

Please help me solve this problems: Problem 1 AFAIK, http://exmaple.com/author maps to nothing (a 404 error page) and http://exmaple.com/author/{username} maps to posts authored by {username}. I ...
1
vote
1answer
227 views

Global variable $post returning incorrect object

In my header.php file, I've been trying to retrieve the slug of the current page, to check it's WooCommerce Products Archive/shop page. I followed this similar question's answer, to no avail; instead ...
0
votes
1answer
87 views

Apply template by path/slug related to custom post type?

I have a custom post type called "project" and an accompanying single view template labeled single-project.php On the landing page for each project, I have sub-navigation that points to separate sub-...
0
votes
2answers
517 views

Bulk append URL (add word to slug)

Is there a way to bulk add one word at the end of each URL for posts? I have around 3500 posts and it would be time consuming to add to each one. For example URL's are www.example.com/my-post/ www....
0
votes
1answer
497 views

Action hook save_post for newly created posts - $post object data is all empty

When a post is created, I need to auto-generate a PDF version of the post. The problem is that the global $post object is mostly empty except for the post ID. I need to get the newly created post's ...
0
votes
1answer
299 views

Remove slugs from custom posts type

I am trying to remove custom posts name from permalink, this code works fine for one custom post but I am trying to remove the slug for 3 more custom posts. Can anyone help me rewrite it to handle ...
0
votes
2answers
21 views

Show custom post with custom categories with specific slug

I'm trying to pull through a custom post with a custom categories and show only a specific slug. e.g. Custom Post (Job Board) - Custom Category (Job Sector) - Specific Slug (Industrial) What I have ...
0
votes
1answer
26 views

Problem with permalinks

I have changed the category base name and now it is "blog", it works ok. But when I change structure by /blog/%category%/%postname%/. It shows 404. If I remove blog in structure it works again, but ...
0
votes
1answer
638 views

Hook on slug generator

I'd like to change the slug that is automatically generated when creating a post. I'd like to add a meta before, making a thing like [meta]-test-slug-2 I guess there's a hook on when WP ...

1 2
3
4 5
13