A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
0answers
11 views

Need to return a list based on Slug

I need a search field to return only a specific slug when the user types it. Basically, I need to create pages for students and each student page will be displayed only when user types the page slug ...
1
vote
0answers
13 views

force permalink slug for page vs post_type slug parent

I have setup permalink for post_type "directory" with this slug domain.com/directory/company-name now when I try create page with domain.com/directory is detect as parent of post_type "directory" ...
0
votes
0answers
11 views

Removed slug from custom post type URLs page template issues

I use this function Remove slug from custom post type post URLs to remove slug from custom post type URLs .. but now I have issues... page.php is not working ... so now my pages with default template ...
0
votes
1answer
29 views

List taxonomy term slugs within shortcode (do_shortcode)

I'd like to list the taxonomy terms within my shortcode. This is how I get the list of terms (separated by commas): <?php $terms = get_the_terms( $post->ID , array( 'shoptype' ) ); ...
1
vote
1answer
77 views
+50

Post slug changed using code doesn't reflect on editor when post is published

I've a CPT (lets say Event) with a custom date field (start_date). I'm trying to generate the post slug (post_name) as start_date + post_title (separated by -). I've tried using the filter ...
1
vote
1answer
35 views

WP_Query tax query part of slug

I have problem with filtering post with tax query. I have a custom taxonomy called 'actors' and example of the slug is 'david-hasselhoff'. The problem is the post is found when I search with 'david ...
1
vote
0answers
18 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
40 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
22 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"&...
1
vote
2answers
37 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', ...
0
votes
0answers
38 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
29 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
51 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-...
0
votes
0answers
13 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
0answers
18 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
14 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 ...
0
votes
1answer
49 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
0answers
25 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
27 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
28 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
0answers
26 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 ...
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
0answers
19 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
34 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 ...
0
votes
2answers
78 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
20 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 ...
1
vote
0answers
68 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 ...
1
vote
1answer
39 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
1answer
17 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
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
15 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
0answers
17 views

Custom Post type slug

Is it possible to structure my CPT for using it in the url slug? E.g CPT: menupage CPT2: categorypage I will need something like this www.domain.com/menupage/categorypage
0
votes
1answer
103 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> ...
0
votes
0answers
19 views

home page slug editor missing from WordPress

the website that I am working has been developed by a web designing company. i see that they disabled the home page slug editor but the rest of the pages has the edit option. Now I am trying to add a ...
0
votes
1answer
56 views

Rename a slug label

In my custom post type there is a custom taxonomy that has the usual Title, Slug and Description fields. I'm expecting the end user to not understand what the slug is for, and in my case it needs to ...
1
vote
0answers
27 views

Assign same parrent Page to pages AND custom post types

I have a page, where I list our current free job positions, let's call it Career. In it's content all custom post types of type job_position are being displayed. For some specific reasons I need to ...
1
vote
1answer
38 views

Remove post type slug of all post types from permalinks

I know similar questions were asked before, but this is new account and I can't comment there. This code remove post type slug from permalink. But I have a lot of post type. How can use this code for ...
0
votes
0answers
71 views

Wordpress pagination not working when page has /amp slug

<div class="pagination"> <?php global $wp_query; $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( ...
0
votes
1answer
45 views

Make user’s first and last name as user slug

I allow users to sign up with their first name, last name and e-mail addresses. I want to make their first and last name as slug. For example user first name is “John” and last name is “James”. The ...
0
votes
0answers
42 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
26 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
40 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
33 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
112 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
48 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
65 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
22 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
94 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
34 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
108 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 ...