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

Change the slug ( url ) to a sequence number starting from 0 in the custom record type?

A notionally custom post type is created - mods I want url to be of type site.com/mods/XXXX where XXXX is serial number in category (not global ID(%post_id%)) That is it starts with 0 and goes further ...
0 votes
0 answers
22 views

Different template fallback when changing permalinks

I am creating my own WP theme from scratch. Super basic stuff. But something drives me nuts. First of all, took me long time to realize that the page with all the posts is home.php. I thought it would ...
0 votes
0 answers
14 views

Fetch post by author slug

I was wondering if there is a way to fetch post by author slug in the WP rest api ? I've read how I can fetch by author ID but I'm working on a react app and I need to fetch based on URL, and the url ...
0 votes
0 answers
14 views

Custom Post Type with multiple Custom Taxonomies / Hide Taxonomy Slug from URL

I have a Custom Post Type with 4 Custom Taxonomies. Everything is working great about this part. But, right now my taxonomies pages URL are: website.com/taxnomy/taxonomy-item I would like to have: ...
0 votes
0 answers
21 views

how to add permalink/slug to wordpress custom link menu item

In WordPress wp-admin navigate to : Appearance > Menus > Add menu items > Custom Links in Custom Links we can add a CSS ID in the URL field, example : in another page, i have html tag ...
0 votes
0 answers
28 views

How to transform multiple parameter URL to clean URL

I have a problem in my search function. when searching to the search field, I am fetching data from multiple get parameters in the URL. here is the url: domain.com/?s=&post_type=store&...
0 votes
2 answers
61 views

how to get full category path including parent and subcategories

How do I get the full category path including the subcategories? I am using if ( is_archive() ) { $term = get_queried_object(); $page_path = $term->slug; } https://mandoemedia.com/blog/...
  • 1,588
0 votes
0 answers
22 views

How to remove slug from front page?

I recently got the role of admin for my organization's website. Site is using WordPress 6.0, with plain permalink settings. I decided to change to pretty permalink. After changing to them, the ...
  • 1
0 votes
0 answers
20 views

How to change CPT single post slug

I need to automatic change slug for all CPT posts. I want it written backwards. For example: Post title: My super post 1 Default post title slug: my-super-post-1 Post title slug after automatic ...
  • 27
0 votes
0 answers
53 views

Make the home page's slug visible in the browser's URL bar

Is it possible to show the WordPress home page slug visible in the URL bar? I mean when someone visits my WordPress website home page rather than displaying (considering that my website URL is website....
  • 1
0 votes
0 answers
26 views

How to search by slug and old slug in single API

I need to search for wordpress posts with input slug or old slug only 1 parameter in single API. Now I'm using 2 url: 1. /wp-json/wp/v2/posts?slug=hello-world 2. /wp-json/wp/v2/posts?meta_key=...
0 votes
1 answer
16 views

Trying to add array of paths to post permalink

Am trying to add custom path to my article posttype so my article path will be www.example/parent-post-1/parent-post-2/the-actual-post i tried to add this code /** * @param $post_link * @param $id *...
1 vote
1 answer
55 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', ...
0 votes
1 answer
78 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/%...
0 votes
1 answer
18 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 : ...
  • 11
0 votes
1 answer
41 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) ...
  • 176
0 votes
1 answer
54 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')....
0 votes
1 answer
96 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) { ...
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 ...
  • 1
0 votes
0 answers
15 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 ...
  • 1
0 votes
1 answer
22 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. ...
1 vote
1 answer
31 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 ...
  • 23
0 votes
1 answer
27 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....
0 votes
0 answers
11 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....
  • 101
0 votes
2 answers
50 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 ...
1 vote
1 answer
144 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 || ...
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 ...
0 votes
0 answers
31 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 ...
0 votes
1 answer
48 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....
0 votes
1 answer
32 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 ...
  • 119
0 votes
0 answers
14 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/...
  • 1
0 votes
0 answers
21 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'...
  • 1
0 votes
0 answers
13 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/...
0 votes
0 answers
179 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. ...
  • 123
0 votes
0 answers
21 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 ...
  • 79
0 votes
0 answers
56 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 ...
0 votes
0 answers
55 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 ...
  • 11
1 vote
0 answers
16 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 ...
0 votes
0 answers
37 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 ...
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-...
  • 41
0 votes
1 answer
188 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/...
  • 976
0 votes
0 answers
31 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 ...
  • 119
0 votes
0 answers
34 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 ...
  • 1
0 votes
1 answer
259 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(); ?> <?...
  • 976
0 votes
1 answer
40 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', '...
  • 314
0 votes
1 answer
16 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 ...
0 votes
1 answer
26 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/ ...
  • 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 ...
  • 1
0 votes
0 answers
89 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,...
  • 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 ...
  • 1

1
2 3 4 5
15