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
0
votes
1answer
13 views

Disable WordPress from changing URL slug when post is published

We have post titles that contain emojis. While creating a post and saving it as a draft, the URL slug generated by WordPress doesn't add the [emoji] from the title. However, when the post is published,...
5
votes
3answers
18k 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 ...
0
votes
1answer
16 views

How to prevent WordPress from redirecting single page to prefixed category archive with same name?

I have been trying to solve this problem for hours. I would like to have a page with a simple slug (/blog) and a category term with the same name (/category/blog) exist on my site together at the same ...
0
votes
2answers
753 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 ...
0
votes
0answers
6 views

Creating sub-slugs without actual parent page

I would like to create individual pages for each member within a team: http://www.example.com/team/person-a http://www.example.com/team/person-b In the navigation menu I provide a parent entry ...
0
votes
0answers
20 views

Multiple slugs for one taxonomy?

I currently have a taxonomy registered with slug moods. So I access the terms with mydomain.com/moods/happy. I also want to access this with mydomain.com/tags/happy. I don't want to redirect. I want ...
0
votes
1answer
14 views

Rewrite/Change custom taxonomy slug

I want this url: => mydomain.com/genre/chant to be rewritten as => mydomain.com/chambers/chant. I want the users to access mydomain.com/chambers/chant instead of mydomain.com/genre/chant. genre ...
0
votes
2answers
667 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
1answer
769 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 ...
43
votes
7answers
104k 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
0answers
9 views

How to set custom slug for core post type “post” and core taxonomy “category”?

I am looking for solution to set specific slug for posts and categories. I have default post type and taxonomies (category, tags). Permalink settings - "/%category%/%postname%/" I need ...
11
votes
5answers
14k 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
4
votes
2answers
59 views

How to change default page slug?

I have a CPT called jobs and a page named Job Apply. I am trying to achieve something like below url: http://example.com/job-slug/apply Where, job-slug can be any job. i.e Programmer, Developer etc.. ...
0
votes
1answer
12 views

page-slug.php not working but only for specific slug

I'm trying to create a page called "Comics" with the slug "comics" to use as the main table of contents for my webcomic site. I've created a page-comics.php file, however when I ...
22
votes
5answers
25k views

How does WordPress generate URL slugs?

Is there a page somewhere that details exactly how WordPress generates slugs for URLs? I'm writing a script that needs to generate URL slugs identical to the ones WordPress generates.
0
votes
0answers
23 views

Why does updating permalink structure only update posts and not pages?

This might sound like a stupid question but I've honestly looked everywhere. Currently my WP Page structure is {site-title}/{page-title}. This works fine, however I want to change the permalink ...
0
votes
0answers
13 views

Get postID from custom permalink using slug

I'm trying to get the postID of from the URL of articles. I'm using the WordPress REST API to try and do it: https://yas.com.hk/blog/wp-json/wp/v2/posts?slug=someSlugHere When i try grabbing the slug ...
1
vote
0answers
22 views

Rewrite URLs - Custom Post Type - Post Slug, Taxonamy Slug

Am using a third-party plugin for listing schools. Custom Post Type = school Custom Post Taxonomy 1 = school_type (eg. values = Primary, Intermediate) Custom Post Taxonomy 2 = school_location (eg. ...
0
votes
0answers
8 views

Edit with elementor not working!

i use elemetor based theme and now the edit with elementor option doesn't work. But when i change the slug of the page it will work. but within the old slug it will not. what is the issue? anyone ...
3
votes
1answer
29 views

Prevent changing the length of post_name column on WordPress Update

We've some Arabic websites running on WordPress, and use Arabic slugs in the posts' URLs. You know that post slug is stored in the post_name column in wp_posts table, and the default length of this ...
0
votes
0answers
16 views

How to prefix `attachment` permalinks with `attachment`?

Could you please help me to prefix attachment permalinks with a custom string (for example attachment) Such that example.com/attachment-slug becomes example.com/attachment/slug? Apply only to posts ...
0
votes
1answer
510 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
0answers
16 views

Alter post slug by a filter that is fired just after a post is created

) I found (for example in Set default (auto) slug prefix for Tags) that it is possible for example add my-taxonomy prefix in front of all taxonomy slugs (permalinks). The post is outdated now since ...
0
votes
0answers
18 views

How Can I Create a Friendly Slug for a Dynamic Page?

I built a dynamic page template that pulls biography information from a MySQL table. The page works fine but the URL is ugly. Officer-Biography/?ID=1 I have a set of canonical slugs that I want to use ...
0
votes
1answer
631 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
29 views

Code snippet to add filter pre_post_link to change Media URL (post_type attachment permalink/slug)

I found a very good code snippet to add a "base" into URL of blog posts: Custom permalink structure with a prefix just for posts I tested it and it works great for post_type: post (to test ...
0
votes
0answers
9 views

Get The Most Recent Post of a Specific Term From Current Post

I'm developing a website for a webcomic and I'm having problems getting the page system to work. I have a custom post type set up for comic pages, and the pages are organized into volumes (with ...
0
votes
1answer
572 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 ...
2
votes
3answers
4k 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' =&...
5
votes
5answers
18k views

Add menu and submenu in admin with a URL instead of slug?

I use this function and hook: function mysite_admin_menu() { add_menu_page( 'Categories', 'Catégories', 'administrator', 'categories', 'a_function' ); add_submenu_page( 'categories', 'Manage', '...
1
vote
2answers
592 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 ...
1
vote
1answer
757 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
667 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
1answer
65 views

Removing old_slug and old_date from WordPress Database

I am trying to clean my database. In the wp_postmeta table I see thousands of _wp_old_slug rows. I am not concerned about these old links not being redirected. What are the pros and cons of removing ...
0
votes
1answer
680 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 ...
0
votes
1answer
2k 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
0answers
18 views

Translation of page slugs using code

I've translated my website using translatepres plugin. I now need to translate all the page slugs like from site.com/se/contact/ to site.com/se/kontakt/ Please provide some useful funtion or hook to ...
5
votes
1answer
899 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
2answers
1k 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; ...
0
votes
1answer
12 views

A way to export slug as meta tag

Is there's a standard way to expose post slug as meta tag, so it appears in HTML as say <meta name="slug" content="my-article-123">?
0
votes
0answers
20 views

multisite 404 subfolder same name slug as site

To keep this short, as a disclaimer, I'm not that versed with WordPress, servers, etc, so I might talk gibberish: The Issue 🠺 I have a multisite root, let's call it msite.com 🠺 This site spawns ...
1
vote
1answer
34 views

How to query for pages/post depending on slug?

I work on a blog that contains both English and Romanian posts. I made the site bilingual by prefixing the slug of every article with ro- and en-. It is a simple way and it works pretty well. Now I ...
1
vote
1answer
3k views

Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url

I have been reading dozens of posts and honestly, I have many doubts on how this work. Furthermore, I think that with WP3.1 more issues have been added here because I am having even more problems now ...
0
votes
2answers
781 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
1k 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 ...
16
votes
5answers
17k views

Regenerate Slugs From Title of Posts

is it possible to regenerate the slugs programmatically after changing the titles of the post? Numerous post titles were updated and the slug was not updated with the title so I need to regenerate all ...
0
votes
1answer
180 views

Post & Page with same slug

I've got a post and a page with this slug: signatures-for-office-365 That's right, the same slug for a post and page. Permalinks settings are: /news/%postname%/ When the post URL is requested, wp ...
1
vote
3answers
17k views

Show all wp_get_post_terms slugs

I am using the following code to display my custom taxonomy slugs. However it is only displaying the first category and not all the related categories. I know this is fairly simple and is to do with [...
0
votes
0answers
12 views

How to add filter to post_name just for a CPT

I was seeing this post on how to add a filter that allows adding dots to post_name. I made a change to use only dots. I want to make it work only for one type of CPT. But I don't know how to check ...
2
votes
4answers
6k views

WP appending -2 to the end of my slug. Where are the originals stored so I can delete them?

I've been learning about taxonomies, custom posts etc though a lot of trial and error. I finally have it working how I want, however now I am getting some conflict with my desired slugs. I can't name ...

1
2 3 4 5
14