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
1
vote
2answers
33 views

Wrong generated page_name/slug on first publish of custom post type

I have set up a custom post type (CPT) with the support for editor removed: register_post_type( 'review', array( 'label' => 'Reviews', 'labels' => array( 'name' => 'Reviews', ...
1
vote
0answers
13 views

Index page with the same id as the slug

I have wanted to ask this for a long time.. I have never worked out how to do this, is it possible? mywebsite.com/pots - This to be an index page showing posts or custom posts mywebsite....
0
votes
1answer
22 views

WP_Query tag can't find part of slug

I have a custom post type called movies and each movies has tag(s) with the name of the actors. Recently I am trying to allow user to found posts through entering actors' name. This is what I have ...
0
votes
1answer
30 views

Replace image name on upload to the new post name on front-end form

I'm using this form to replace featured images and post title on my frontend form: <form id="featured_upload" name="featured_upload" method="post" action="#" enctype="multipart/form-data"> <...
0
votes
1answer
16 views

Edit the post title from the frontend

I have this form that allows-me to change some things of the current post in my frontend: <form id="featured_upload" name="featured_upload" method="post" action="#" enctype="multipart/form-data"&...
0
votes
1answer
519 views

How to change parent permalink?

I have a theme with hardcoded permalink structure for some posts. Those posts open with site.com/parent/page structure. I created a filter that replaces the link from "site.com/parent/page" to "...
0
votes
0answers
23 views

Two Custom Post Types in Permalink + Duplicate Slugs Issue

I'm having some trouble with WP adding those numbers onto the end of my slugs if it thinks it's a duplicate slug. The issue, though, is that it's not actually a fully duplicate URL, since I include a ...
0
votes
1answer
21 views

How can i edit all posts slug in bulk keeping WP native redirect?

When i edit a single post slug the old url redirects to the new one automatically. I need to do this in bulk. There is a text that appears on thousands of permalinks and i want to remove it from ...
0
votes
0answers
50 views

Include a page's “category” in its URL

My site is for landing pages, not a blog - so it contains pages, not posts. I want URLs like this: https://www.example.com/shoes/nike-sport-super-red https://www.example.com/shoes/adidas-...
4
votes
1answer
4k 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
0answers
11 views

How to quickly fix duplicated term slugs in hierarchical taxonomies?

my problem is that I've imported in wordpress some hundreds of terms of a custom taxonomy, from another system, in 5 languages. I've found out those terms have sometimes duplicated slugs, and they're ...
0
votes
1answer
463 views

Rewriting archive page slug to be different than custom post type slug

I am having trouble changing the slug of my archive page. The goal is to create a page that can be edited from the back end of WP with the slug speakers, but that has already been taken by the archive ...
0
votes
1answer
790 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 ...
1
vote
1answer
591 views

Append date to custom post type url slug

I have a sports website that will have very similar slugs: http://example.com/match/teamA-vs-teamB Sooner than later, teams A and B will play again, and the slugs will repeat themselves: http://...
0
votes
1answer
524 views

Category slug not showing for Custom Post Type

I have a Custom Post Type called 'shows' which makes use of the default Wordpress Category function. I can see my 'shows' posts on /category/%postname% URL's, but when I post the URL the slug looks ...
0
votes
0answers
12 views

Special Characters Url return to 404

I've managed to have permalinks with "@" (at sign) for my page with the help of @Andy's code on How to add dot(“.”) in post slug. But unfortunately, after creating post with @ on the url (example....
0
votes
0answers
12 views

Remove author (user) slug (permalink base) for a Multisite

I have a Multisite Wordpress installation in which I want to change the structure of user permalinks by removing the base "/user/" Current: domain.com/user/unsername I want: domain.com/username I ...
2
votes
1answer
3k views

How to add dot(“.”) in post slug

How to add dot(.) in post slugs? In our blog, we are writing about websites and would like to use their exact address as slug like this: ourdomain.com/example1.com But dots are either removed when ...
36
votes
6answers
88k views

how to get page id of a page using page slug

Im pretty new to wordpress and I was wondering if I could get a page id with it's slug. Is it possible please let me know.
0
votes
1answer
567 views

WP Database generate content for post_name column

I ran a query that deleted all content in post_name (used for SEO-friendly URLs) column. UPDATE wp_posts SET post_name = '' I thought that WordPress would automatically populate new ones if I update ...
8
votes
2answers
4k views

Use category base slug in posts' permalink

The Goal I would like to format my permalinks as follows: for posts: somePrefix/%category%/%postname% for categories: somePrefix/%category% Where somePrefix is the same in both cases. I know that ...
1
vote
2answers
523 views

Custom Taxonomy breaking pages permalinks

I'm stuck for some days with this problem and I don't know what else to do. With %somethingHere% on slug rewrite, pages permalinks are broken (CPT AND CT OK). Without, I don't have my desired Post ...
0
votes
1answer
48 views

Keep subcategory grandson in slug

I have the categories and subcategories father, son, grandson: -father --son ---grandson When creating an post and mark it only in the grandson category, the correct slug is generated: www.example....
0
votes
2answers
52 views

How to define the slug for my custom plugin?

I have created a custom plugin. How do I define its slug? To clarify, if I attach a custom PHP function to the manage_plugins_custom_column hook, and in that function print the value of the $...
0
votes
0answers
23 views

Allow duplicate slugs for pages and posts

My use case is: I have a two pages, they each have a meta information "language". Posts and pages having same language cannot have the same slug, but with different slugs it is totally fine. Currently ...
0
votes
0answers
17 views

Yoast SEO breadcrumbs: how to create a filter that uses the url slug for breadcrumb titles

I know we can manually edit the breadcrumb title for a page or post using Yoast SEO's breadcrumb functionality. But with thousands of posts and pages on an existing site this isn't desirable. My ...
1
vote
0answers
23 views

Is there an equivalent of the PHP function sanitize_key in Gutenberg?

In WordPress's PHP library there is a function sanitize_key used to generate database keys and HTML IDs. I'd like to generate a slug from a title that can be used as an HTML ID, from within a ...
0
votes
2answers
815 views

Is there a way to remove the option to modify the Slug in post.php

I am trying to remove the option to edit the Permalink. I know how to hide it with CSS and I have. But a hacker could simply just go to Inspect Element and change display: none; to display: block; ...
5
votes
1answer
721 views

Change the author slug from nickname to ID

I've changed the default registering option by allowing people to sign up with their e-mail addresses. They also have an option to add their firstname, lastname but it's not required. // Allow email ...
0
votes
1answer
957 views

Why is there /index.php/ in all my links? How do I remove it?

I recently realized that my rss feed is not working, because a plugin was assuming it's under mydomain.com/feed But it isn't. I get an 404 error. I figured out that instead my feed is under ...
0
votes
0answers
25 views

get_queried_object_id combined with wp_redirect gets wrong id

I have the following snippet of code that I am experimenting to restrict access to certain wordpress pages through a plugin. It works... almost. The browser is redirected to the login page, but the ...
3
votes
1answer
3k 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, ...
0
votes
1answer
18 views

Multiple Custom Taxonomy Rewrite

I have registered two custom taxonomies of 'location' and 'type' registered before my post type of 'chalet' and have the rewrite rules set to 'slug' => 'chalets/%location%' 'slug' => 'chalets/%...
0
votes
2answers
694 views

Add category slug as class attribute in a link array

This incredible website and the genius developers here have helped me significantly in the course of my WP Dev over the years, firstly THANK YOU. I am now faced with a problem that I have been trying ...
0
votes
1answer
2k views

Display page over category archive

I removed the /category/ slug using the Yoast SEO plugin so now posts are like this: example.com/news/example Instead of this: example.com/category/news/example now my problem is that if I want a ...
7
votes
4answers
5k views

Can I have two child pages of different parents with the same name?

I have two pages - new.hillsong.com/australia/sisterhood - new.hillsong.com/hills/sisterhood Both pages are displaying the content for the /hills/sisterhood site but they are different pages with ...
0
votes
0answers
16 views

Important : This theme text domain does not match the theme's slug

My text domain is same as my theme name and theme folder also but still getting this error in theme checker : REQUIRED: This theme text domain does not match the theme's slug. The text domain ...
0
votes
0answers
20 views

How to allow dot(.) in slug for custom pages

For this question, I googled and found 2 results. But what I want to do is allow dots in slugs for some pages only. I found results are showing to add a function to function.php file. But it will ...
9
votes
4answers
37k 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
1
vote
1answer
37 views

How can I make the slug of the taxonomy also the slug of the custom post

I have a custom post type and I need to change the slug to match the category. The same as if in the permalink of the blog posts I associated the category with %category%, but in the custom post with ...
0
votes
0answers
18 views

Hide certain product categories from specific pages

I'm trying to hide certain product categories on specific product category pages on my woocommerce shop page. And I found this code to help me: add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 ...
4
votes
2answers
15k views

Disable permalink on custom post type

I have created a custom post type, but I do not want it to have a permalink. By default, after entering the post title, it creates a permalink. I do not need them to be generated. From my reading, it ...
1
vote
0answers
66 views

The default code for “posts_nav_link” on category.php isn't working

I am trying to make my own simple WP theme from scratch and I have run in to some difficulties. Maybe someone can help. I have a category named "News", whose slug is "news". The permalink structure ...
0
votes
1answer
726 views

Change custom post type slug from plugin options

I'd like to give users the option to change a custom post type slug in my plugin. Using this answer, I'm able to hardcode it into a function: Redeclare/Change Slug of a Plugin's Custom Post Type ...
0
votes
1answer
450 views

Load a template page based on part of slug in wordpress

How can I load a particular template based on part of a slug ? Say I have 3 urls that I want to load the same template for so I want to match based on the 'advice-on' Please note I don't want a ...
0
votes
1answer
16 views

Hide a specific category title from displaying on site

I have a website that uses the theme Bodega and uses portfolio categories. Right now I have a page like this: http://185.56.86.90/~onetoncr/manitoulifeandhome.com/property-services/. And it displays ...
0
votes
2answers
568 views

Why does post-slug not get saved for drafts?

I am trying to get the value of the 'new-post-slug' (the bit that you can edit to customize your slug for a post, but bizarrely doesn't have a 'name' attribute as you'd expect a form field to have ... ...
0
votes
0answers
7 views

Auto Slug Generation for Custom Post type based on related post

I have created a custom post type (proof) that don't have any title. But it has a related post (another custom post type => review). Now how to generate slug for "proof" based on related "review"? ...
1
vote
1answer
14 views

How to edit URL Slug?

Some of my blog post slugs show abnormal characters within the edit post screen (ie. 3%e2%80%8b-%e2%80%8bperks%e2%80%8b-%e2%80%8bof%e2%80%8b-%e2%80%8bsmartphone-based%e2%80%8b-%e2%80%8belds) but shows ...
0
votes
1answer
76 views

{Check Theme Plugin} text domain does not match the theme's slug

I have these two issues: 1: WARNING: Your theme appears to be in the wrong directory for the theme name. The directory name must match the slug of the theme. 2: REQUIRED: The  <title> ...