2022 Developer Survey is open! Take survey.

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
1 answer
27 views

Stripping unicode characters out of slug

I am trying to strip the following characters out of slugs: ṁ, ṭ, ḍ, ṇ, ṅ, ñ, ḷ, ṃ. I found this code here (note: I have removed public in order to get it to work) add_action('wp_insert_post_data', ...
user avatar
0 votes
1 answer
9 views

How do I add a tag slug to a category URL to filter posts?

I want to add an option to my site to filter posts by one specific tag on the category page and at the same time have a nice URL (no query strings). So something like this: https://example.com/%...
user avatar
0 votes
1 answer
16 views

How to assign php file(template) to several pages with same prefix page name/slug

Can I assign WP php file (specific template) to several pages with same prefix name/slug using (if is_page(){}) ? If it's possible it could be useful. Is there a php function to do like css selector : ...
user avatar
0 votes
1 answer
18 views

Set term on an attachment using wp_set_object_terms and want to display the full term text but it's showing a slug instead

I have a form that visitors use to upload files and fill out information about them and a function that adds those files to the media library and set various fields (including some custom taxonomies) ...
user avatar
  • 146
0 votes
1 answer
21 views

Gutenberg Editor: dynamically edit slug field based on ACF field

I'm trying to edit the slug field on the right panel of Gutenberg editor and edit its content based on a custom field. I noticed that I can access to the field by using wp.data.select('core/editor')....
user avatar
0 votes
1 answer
44 views

Gutenberg Editor: dynamicaly change slug field with an ACF field

I have a custom field with ACF named "short_title" and I want the post's slug based on this field instead of the post title field. I already wrote this code: function testSlug($post_id) { ...
user avatar
0 votes
0 answers
13 views

How do I structure my permalinks in Wordpress?

I am using wordpress and all I want to do is make the URL appear in the form where, Blogs is mentioned and then the blogname. But I want this structure only when someone visits blogs page. The blogs ...
user avatar
  • 1
0 votes
0 answers
10 views

Page Slug Won’t Change - Can’t Edit Archive Page With Slug or Reassign Slug

I took over a website that was developed by someone else and have rebuilt it to function in Elementor. Everything works great, except for one Archive page with the slug “our-projects” that I can’t ...
user avatar
  • 1
0 votes
1 answer
19 views

Check If Taxonomy A and Taxonomy B has same Slug, 301 Auto Redirect Tax A to Tax B if True in Wordpress

Please How do I achieve this? I have WordPress Default Taxonomy - Tag and a custom Taxonomy - Artist. I want to check for TAGS that have the same slug as ARTIST and 301 redirect it to the ARTIST. ...
user avatar
1 vote
1 answer
25 views

How to manage same slug posts suffix method?

domain.tld/post-name | post_id = 5 and domain.tld/post-name-2 | post_id = 77 The above scenario is the solution brought by wordPress. Let's complicate this a bit and add it as a prefix for ...
user avatar
  • 23
0 votes
1 answer
20 views

How to Redirect WordPress domain.com/?anyword to 404 Page?

Recently I Found some error on WordPress sites that when someone enter a question mark after the root domain and type any word, url shows the Home Page of instance: For instance, Root Domain is abc....
user avatar
0 votes
0 answers
10 views

Changing the wordpress default search url to something like - ...example.com/search?query=keyword

So I was trying to customize the WordPress default search URL and I found several solutions describing how to add a custom slug to the WordPress search URL and turn them into something like ...example....
user avatar
  • 101
0 votes
2 answers
16 views

How do I set a post slug automatically based on taxonomy?

I have a hierarchical CPT event with taxonomy event_category. One of those categories is "Recap". When a user saves a post (could be draft, publish, or edit existing), if the event_category ...
user avatar
1 vote
1 answer
99 views

How to add numeric slug for child page in WordPress 5.9?

I am trying to configure WordPress 5.9 to allow numeric slugs for child pages. Drawing from the 2015 answer to a similar question I took the up-to-date code of wp_unique_post_slug, removed || ...
user avatar
0 votes
0 answers
9 views

Custom post type and multi taxonomies + customize url

I have a custom post types course and two taxonomies type and location sample: Type Math Pure Math Applied math ... Location London Trafalgar Leicester ... For now I manage to show permalink ...
user avatar
0 votes
0 answers
14 views

Taxonomy and Page Slug Same

I set Taxonomy and Page slug same On the Page, I call Taxonomy's all Categories, Page slug Works Correctly with the same taxonomy slug. But When I Click on a single category from the page, it shows a ...
user avatar
0 votes
1 answer
36 views

New posts link to old posts (random)

I’ve recently noticed a strange problem with my posts. When creating a new post, and when the post autosaves before publishing, it will automatically get a wrong permalink format. So instead of: Myweb....
user avatar
0 votes
1 answer
28 views

Why WordPress is picking archive.php instead of page.php?

I have a Custom Post Type (CPT) called "Careers" with "careers" as slug. I created my Careers listing page with Elementor (the page slug is also "careers"), dropped the ...
user avatar
  • 119
0 votes
0 answers
13 views

Calling an Archive Page with specific Tag/Tax ID

Hope I am explaining this correctly. I need to style a specific archive page with the taxonomy: dn_campaign_cat and the tag ID: 115; it shows as below on the front end. www.site.com/campaign-cat/...
user avatar
  • 1
0 votes
0 answers
19 views

Rewrite slug for WP core taxonomies

I have been struggling with this for a while now... I have a custom post type named 'Blog' that uses the default post_tag and category taxonomies of Wordpress. $labels = array( 'name' => __('blog'...
user avatar
  • 1
0 votes
0 answers
8 views

How Can I Remove Child Slug From Grandchild Slug When Using Duplicate Grandchild Slugs?

I am using a plugin which, when you create a category, gives the below type URL structure: example.com/listing-category/automotive example.com/listing-category/catering example.com/listing-category/...
user avatar
0 votes
0 answers
133 views

Modify post slug before saving

I would like to modify the slug of new posts by adding text before and after the original slug. The slug is then sent over an API via a plugin that hooks into save_posts and transition_post_status. ...
user avatar
  • 123
0 votes
0 answers
20 views

Thousands of unwanted URLs/pages with "0" in slug created

We’re experiencing a weird problem which neither our specialized hosting provider WPEngine nor several WP experts could solve so far: Thousands of unwanted URLs/pages are created based on existing ...
user avatar
  • 71
0 votes
0 answers
22 views

Remove custom taxonomy name from the slug - Custom Post Type UI

I'am using custom post type plugin for wordpress. I made custom taxonomy called "category" and made category for my custom post type called "Organic" as well. When I publish custom ...
user avatar
0 votes
0 answers
54 views

Does wordpress take care of slug collisions?

Just spun up a new WP instance (5.8.3) and run in to this problem. I go to create a page with title "Testing", and then go to create a post with same title. Both get same slug, and all links ...
user avatar
  • 11
1 vote
0 answers
14 views

Child post with numeric only slug keeps redirecting to parent

I modified the allow-numeric-stubs plugin code to work with CPTs. You can view my forked repository here: https://github.com/akshatkedia/allow-numeric-stubs WordPress is now allowing numeric slugs for ...
user avatar
0 votes
0 answers
28 views

pagination 404 error, same slug home and categories

I would like to change the permalink for categories. I configured thé prefix of categories with actions I have a page for the home page wich have a slug actions All the website worked correctly. URL ...
user avatar
0 votes
1 answer
50 views

Change of category structure will cause two kinds of URLs for one post

I have changed the category from "file-recovery" -> "zip-file-recovery" to "file-recovery" -> "archive-and-backup-file-recovery" -> "zip-file-...
user avatar
  • 41
0 votes
1 answer
82 views

Automatically redirect a page to a category that share the same slug

This question shows me how to redirect a category to a page that share the same slug, but how would I redirect a page to a category with the same slug? e.g. abc.com/slug ---> abc.com/category/sub/...
user avatar
  • 976
0 votes
0 answers
25 views

How to prevent post_name from incrementing in wp_insert_post?

Whenever I use wp_insert_post with an integer or a stringified integer for the post_name value, it adds a hyphen and an incremental counter to the end of the value. This happens regardless of whether ...
user avatar
  • 119
0 votes
0 answers
29 views

Can't find the page that is using a slug

I am using Wordpress test site and working on a page where I can display Team members. At some point I was working on two Team pages at the same time, just to compare which style I liked more. Along ...
user avatar
  • 1
0 votes
1 answer
139 views

How to get a page's featured image from a term slug (same name)

I have this code (that i've inserted into archive.php) that displays a page's content on the corresponding post category archive with the same slug. <?php $term = get_queried_object(); ?> <?...
user avatar
  • 976
0 votes
1 answer
27 views

Changing slug of all posts

I have a site with around a dozen custom post types. I'd like to change the default post type so that it's URL has a slug of /news/. In my functions file I have: add_action( 'init', '...
user avatar
  • 314
0 votes
1 answer
15 views

Custom Post type dont use custom page template (slug is not right)

I created a custom post type 'gruppen' and a custom page templete 'page-gruppen.php'. I want to use 'page-gruppen.php' to show my custom post type content but the custom post type uses always the ...
user avatar
0 votes
1 answer
25 views

How can I get wordpress slug without certain phrase? [closed]

I got this code: <?php echo basename(get_permalink()); ?> and I get slug of current post page example: "dog-training" And my wordpress posts are like this: domain.com/dog-training/ ...
user avatar
  • 3
0 votes
0 answers
10 views

Different post slug based on archive

I need some help with my current WordPress site. The site got 6 post categories. Posts can have multiple of these categories. The slug of the posts include the category slug. For each of the ...
user avatar
  • 1
0 votes
0 answers
56 views

Allow two posts (from different categories) to have the same slug

My permalink structure is /%category%/%postname%. How to allow two blog posts, of permalinks /categ1/myarticle and /categ2/myarticle to have the same slug myarticle? When I try to change the permalink,...
user avatar
  • 1
0 votes
0 answers
17 views

Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters

I have this line in functions.php: add_filter('post_link', function($link, $post) { return str_replace('foo-', 'foo/', $link); }, 10, 2); and now Wordpress successfully sees example.com/foo/bar as ...
user avatar
  • 1
0 votes
0 answers
53 views

What query string parameter is available for index.php, that works for both pages and blog articles?

I have a page /page1 and 2 articles /article1 and /another-article1. Which query string parameter for index.php is available to show the content? I tried: ?p= but index.php?p=page1 is working index....
user avatar
  • 77
0 votes
1 answer
54 views

A different permalink structure for different categories

My Settings > Permalinks is set to /%category%/%postname%/. Thus blog posts have URLs like example.com/category12/article1. I would like to keep this permalink structure for most articles. Which ...
user avatar
  • 1
0 votes
0 answers
23 views

Too many redirects (ERR_TOO_MANY_REDIRECTS) only on one page

Everything was working fine but I noticed a slug for a page had a -2 on the end of it and I didn't like it. I found out it was trying to share a URL with an image so I gave the image a new URL and ...
user avatar
0 votes
0 answers
26 views

OK to redirect the root WordPress category slug?

In my new WordPress site, I've started using parent and child categories, so that I've begun to have working links of this sort: https://www.example.com/category/photography/ https://www.example.com/...
user avatar
  • 1
0 votes
1 answer
30 views

How to have article URL like example.com/article1 and example.com/foo/article2?

By default, blog articles have an URL like example.com/article1. Changing Settings > Permalinks with /%category%/%postname%/ makes it possible to have URL like: example.com/foo/article2 Question: ...
user avatar
  • 1
0 votes
0 answers
23 views

Add base folder to CPT and 301

I am developing a WP install that is using a third party plugin that interprets searching the data in an unusual way. In short, the rebuild has made the URL structure change for taxonomies, from ...
user avatar
  • 203
0 votes
1 answer
29 views

Custom rewrite rule based on other custom post type title

I am trying to change url of one custom posts type based on name of the other one. To achieve this. first custom post /test1/aaa the other custom posts aftere rewrite /test1/aaa/123 /test1/aaa/456 /...
user avatar
  • 45
0 votes
1 answer
47 views

How to get a page slug in WordPress?

I would like to know if anyone knows how I can get the call to a wordpress slug with a wordpress function. All this in order that everything is added automatically in the following way, EXAMPLE: <...
user avatar
0 votes
1 answer
35 views

Wordpress is adding "category" word before my actual category name in url (and this is unsolicited)

Check out this image: This is twenty twenty theme, a default theme. I started facing the problem with a non-default theme, so I switched over to this other theme just for testing, same thing. What's ...
user avatar
0 votes
0 answers
66 views

How Can I Use Equal And Question Mark In Category Slug?

I need to add a question mark and equal the category url. I need this: site.com/stack?exchange=ask But Wordpress does not allow specific characters in url. So i tried to use html encodes in category ...
user avatar
  • 1
0 votes
2 answers
78 views

Get nice name of category from slug (remove dashes of category)

I have a function in a theme: $category = isset($_GET['category']) ? wp_unslash($_GET['category']) : ''; The problem is that it outputs my categories like this: "test-category" I want, ...
user avatar
  • 287
0 votes
0 answers
41 views

How to remove category name for only one category?

My current WP config looks like this: in permalink setting Custom Structure set to /%category%/%postname%/ Category base set to . My question is: how to remove category name for only one category IE: ...
user avatar

1
2 3 4 5
15