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

Do post_names have to be unique?

I'm not 100% sure about this, so I'm asking: Does a post's post_name (aka: a post slug) have to be unique? Do they also have to be unique if each post has a different post type (a post and an ...
0
votes
1answer
13k views

Get the Current Page Slug-Name

I want to Retrieve the Current Pagename , Inside my Breadcrumb , i tried many ways to get the idea work , but unfortunately they didn't work e.g : <?php wp_title('true'); ?> ...
0
votes
1answer
444 views

Slug collision between page, taxonomy and custom post type

I have a rare scenario where I need an advanced Rewrite URLs in order to retrieve the desired URL structure. Here's the thing. I have 3 separate items to manipulate with: Page Custom post type ...
0
votes
2answers
164 views

How to find a specific post_type using its “rewrite slug”?

I've been struggling with a quite specific point. I registered some custom post types and specified the rewrite slug for each one of them. 'rewrite' => array( 'slug' => 'my-slug' ), ...
1
vote
1answer
739 views

Change author slug and functionality

Please help me solve this problems: Problem 1 AFAIK, http://exmaple.com/author maps to nothing (a 404 error page) and http://exmaple.com/author/{username} maps to posts authored by {username}. I ...
1
vote
1answer
427 views

Global variable $post returning incorrect object

In my header.php file, I've been trying to retrieve the slug of the current page, to check it's WooCommerce Products Archive/shop page. I followed this similar question's answer, to no avail; instead ...
0
votes
1answer
141 views

Apply template by path/slug related to custom post type?

I have a custom post type called "project" and an accompanying single view template labeled single-project.php On the landing page for each project, I have sub-navigation that points to separate sub-...
0
votes
2answers
730 views

Bulk append URL (add word to slug)

Is there a way to bulk add one word at the end of each URL for posts? I have around 3500 posts and it would be time consuming to add to each one. For example URL's are www.example.com/my-post/ www....
0
votes
1answer
1k views

Action hook save_post for newly created posts - $post object data is all empty

When a post is created, I need to auto-generate a PDF version of the post. The problem is that the global $post object is mostly empty except for the post ID. I need to get the newly created post's ...
0
votes
1answer
351 views

Remove slugs from custom posts type

I am trying to remove custom posts name from permalink, this code works fine for one custom post but I am trying to remove the slug for 3 more custom posts. Can anyone help me rewrite it to handle ...
0
votes
2answers
23 views

Show custom post with custom categories with specific slug

I'm trying to pull through a custom post with a custom categories and show only a specific slug. e.g. Custom Post (Job Board) - Custom Category (Job Sector) - Specific Slug (Industrial) What I have ...
0
votes
1answer
26 views

Problem with permalinks

I have changed the category base name and now it is "blog", it works ok. But when I change structure by /blog/%category%/%postname%/. It shows 404. If I remove blog in structure it works again, but ...
0
votes
1answer
981 views

Hook on slug generator

I'd like to change the slug that is automatically generated when creating a post. I'd like to add a meta before, making a thing like [meta]-test-slug-2 I guess there's a hook on when WP ...
0
votes
1answer
155 views

Custom post type URL structure with site.com/custom_taxonomy_slug/post_name

I'm quite new to wordpress and I'm struggling to adjust the URL structure to my needs. I work with a theme that provides a plugin for a custom portfolio post type along with custom taxonomies : ...
0
votes
0answers
2k views

Allowing slash in slug/permalinks

I'm trying to create slugs on WordPress posts based on input from some Advanced Custom Fields and the post title. The code below creates the slug based on the data in the fields, but only the two ...
0
votes
2answers
2k views

Duplicate slug/permalink issue

I have a website which lists concerts and festival and some of them are returning each year. I have made a custom taxonomy where you can add the post to a year (2017, 2018, 2019 and so on). I also ...
0
votes
1answer
68 views

wordpress how to replace url /bar with foo/bar for custom post type

In my wp site there is a custom post type movies.i used cpt plugin to create it. so if i have a post with title zootopia it's url appear as , http://localhost/mysite/movie/zootopia/ however i want ...
2
votes
1answer
2k views

Using Blog Parent Slug on Blog Posts Only

(Advanced warning: novice question) I'm trying to find a way to add a blog slug to any blogs I post. Example: mysite.com/theblog/aparticualrblogpost mysite.com/theblog/anotherblogpost Any page ...
0
votes
1answer
42 views

Word /blog/ in slug post, problems in CPT. Solutions?

I have a problem. I need that in my posts the url slug will be /blog/ in single and categories. If I change the permalinks in Dashboard I have problems with Custom Post Type 404. Now I have this ...
0
votes
0answers
31 views

Convert slugs on post publish

I'm currently testing a content crawler which crawls a feed and saves post in my website. I should also mention that my website has a Greek -> Latin slug plugin. I've been trying to figure this out, ...
0
votes
2answers
103 views

Taxinomy slug as var in parent archive page, without having a specific taxinomy page

I'm not exactly sure of the best way to ask what I am trying to achieve, so I'm going to describe it here. If someone can identify a more succinct way to ask this, or if it's been answered in a ...
0
votes
0answers
47 views

How to create multi-slug admin page and retrieve it with $_GET or something?

So, I have seen many plugins use multi-slug to check updates and retrieve it. E.g. it have a button which redirects basename($_SERVER['REQUEST_URI']) which is equal to admin.php?page=ani-plugin-...
0
votes
1answer
4k views

Getting page slug

So if I search 'How to get current page slug', there are bunch of results that suggest to use following snippet. global $post; $post_slug = $post->post_name; echo $post_slug; But issue is, if I ...
2
votes
0answers
222 views

Allow UTF-8 characters in the user slug part of URL

I want to be able to specify a custom slug for an author URL that may contain UTF-8 characters. I used the plugin Edit Author Slug but it does not accept UTF8 characters like accented characters, ...
0
votes
1answer
108 views

Custom Post Type duplicating slug for new posts

// register custom post type forums function fp_forum_post_type() { // set up labels $labels = array( 'name' => 'Forums', 'singular_name' => 'Forum', 'add_new' =&...
3
votes
1answer
25k views

How to get slug of current category in taxonomy template?

How can I retrieve slug of current taxonomy being viewed in taxonomy template? I tried to codex but found nothing on taxonomy template page. To further explain, lets say I am viewing category flowers ...
0
votes
1answer
662 views

Use /prefix/postname as a slug in post_name?

I have a custom field that I would like to use as the post's slug. I'm able to get the custom field to be used as the slug for the post but I'm having problems attaching a /prefix/ before the postname....
0
votes
0answers
2k views

How do I rewrite the slug for a custom post type with the category base url

I have a custom post type products and I have a custom taxonomy 'product_Range`. I would like the url structure to be as follows: www.mysite.com/products/ www.mysite.com/products/%category% www....
1
vote
0answers
259 views

How to show “slug” in admin column?

function my_school_taxonomy() { register_taxonomy( 'schoolcategory', 'school', array( 'label' => __( '學校分類' ), 'rewrite' =...
0
votes
0answers
120 views

Display list of pages that contain a certain string within the slug

I have an existing shortcode that generates a list of child pages/posts. I add the shortcode to the parent page, and then it lists out all of the children. HOWEVER, what I really want is to be able ...
1
vote
1answer
489 views

Remove custom post slug and add category to custom post type

I am registering a custom post type through this function in a plugin. There is a problem that the end url of this post type has a slug. I want to remove that slug and replace it with the category of ...
0
votes
1answer
186 views

Using URL rewrite to add custom URL for custom post type

I'm using ACF to make a multilingual site. My custom post URLs must work both with and without /en/ as prefix. E.g. mysite.com/posttype/any-slug/ and mysite.com/en/posttype/any-slug/ must display the ...
13
votes
1answer
7k views

How to set post slug when using wp_insert_post();?

My theme uses a custom template to render some contents. To use this template, I'm hooking into after_switch_theme to create my own page after the theme is activated, and then assign this template to ...
0
votes
1answer
42 views

how to output tags that has specific value in slug

How can i output tags thats has value "-en" in slug I have slug which looks like this "term1-en","term1-de" and so on. And how can i correctly only those tags that has "en" in their slug. This what i ...
3
votes
0answers
691 views

Import Wordpress Post Slug with Forward Slash

Building a news site in Wordpress. Importing articles from old, custom-built site. I want the imported URLs to be the same, to preserve SEO equity. The URLs should look like: site.com/category/...
0
votes
1answer
535 views

Display Terms Comma separated and Hyperlinked

I'm trying to display Terms comma separated along with hyperlinking each term with its slug however, the terms are not hyperlinked with the slug. Terms are coming comma separated but the slug isn't ...
0
votes
1answer
135 views

How to prevent Wordpress from abbreviating long slugs?

By default, WordPress cut some words from long titles of posts, How to prevent Wordpress from abbreviating long slugs?
2
votes
0answers
50 views

Removing “category” from URLs then “add_endpoint()” won't work…

For example, the original URL would be http://localhost/category/sub_category/. What I want is http://localhost/sub_category/, furthermore, I want to add an endpoint to the URL which looks like http:/...
0
votes
0answers
442 views

Custom post type post_type_link gives “page not found” on any other custom post type

I'm trying to edit an existing custom post type for the theme I'm using called "Divi". This custom post type is called a "project". Now I'm trying to change the default slug of: http://example.com/...
6
votes
1answer
10k views

How to get custom post type label and singular label from its slug?

Let's say I have a Custom Post Type with the slug books. The label is Readings and the singular label is Reading. I want to display the Custom Post Type label in one of the custom post type's post. ...
0
votes
1answer
66 views

Two CPT: one is using part of the custom rewrite slug from the other

I've these two CPT: Publications and Books. The custom rewrite slug for Publicationsare just /publications/ I want the Books CPTs rewrite slug to be /publications/books/ But I do that and I get an ...
1
vote
1answer
498 views

How can I add a page's ID to its permalink using WP_Rewrite?

I have a client who is adamant that the permalink structure for pages must be along the lines of postname/postid, such as test-page/7. I've gotten as far as adding the post name using $wp_rewrite->...
0
votes
1answer
234 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 ...
0
votes
0answers
156 views

Default post category overruling %category% setting for posts URL

I've set default post category in WP Writing - settings to "news" Added a couple post categories like "blog" and "event" Added a couple posts in "news" , "blog" and "event" categories and each time ...
0
votes
1answer
36 views

Wordpress page not showing up - replaced with last 10 posts?

I've been working hard at a system to upload articles to. Specifically via a custom post who's URL changes based on an ACF selection field. I've had great success, with users here helping me on the ...
0
votes
1answer
264 views

Custom permalink rewrite rules - how do I fix this?

I've spent about 6 days trying to research and decipher a way to have a custom post type's permalink change based on an Advanced Custom Fields(ACF) selection element. From my experiments, it's half ...
0
votes
0answers
26 views

How do I locate a third party page represented as a slug in my WordPress website?

how do I determine where a WordPress page is located in the admin panel when the page has been built via a third party plugin and has been uploaded to a directory that is just represented by a slug? ...
1
vote
1answer
426 views

How to remove slugs from multiple custom post types

I've seen several posts lately with people easily removing the slugs from a single custom post type via the following function: function hf_remove_slug( $post_link, $post, $leavename ) { if(('...
1
vote
1answer
2k views

Custom page slug without creating a WP page

I am developing a WP plugin in which I have a WP page called my-account, but I have some more child pages of its like account-edit, account-misc etc... so I would like to call these pages in this way ...
0
votes
1answer
4k 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 ...

1
3 4
5
6 7
15