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
43 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
2k 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
168 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
76 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
15k 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
468 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
170 views

How to show “slug” in admin column?

function my_school_taxonomy() { register_taxonomy( 'schoolcategory', 'school', array( 'label' => __( '學校分類' ), 'rewrite' =...
0
votes
0answers
72 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 ...
0
votes
1answer
232 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
90 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 ...
8
votes
1answer
4k 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
33 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 ...
1
vote
0answers
472 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
373 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
81 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
45 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
337 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/...
4
votes
1answer
6k 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
58 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 ...
0
votes
1answer
387 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
130 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
145 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
35 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
216 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
20 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
346 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
2k 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 ...
0
votes
2answers
537 views

WP gives 404 error for custom post type with GET variable

I use the following method to add a $_GET Variable to my custom post type in wordpress. add_filter('query_vars', 'add_type2_var', 0, 1); function add_type2_var($vars){ $vars[] = 'type2'; return $...
0
votes
0answers
19 views

My post permalinks are always the same

I noticed all my new posts have the same permalink. I noticed it was the same as my sticky post so I removed that setting but it didn't change anything. If I create a post called "Permalink Test" I ...
0
votes
2answers
2k views

add_rewrite_rule - Page Slug from “/foo-bar/” to “/foo/bar/”

I need foo-bar to become foo/bar instead: //domain.com/foo-bar   »   //domain.com/foo/bar I'm rebuilding a website that is currently in a home-brew CMS. They have a few pages with ...
0
votes
2answers
92 views

Get slug to point to different content of the same post

I have a custom post type in WordPress with custom meta boxes. So I need a hierarchal post and also have a custom template set for each of the post (either Type1 or Type2). This is how my slug looks,...
0
votes
1answer
244 views

Author permalink

I have changed my permalink "author". Now your slug is "user". But the user page slug is also "user". How can I make sure there is no conflict between both slugs? I hope help, please! Thanks
0
votes
2answers
865 views

Issue redirecting 'blog' to 'news' in WordPress using .htaccess

I know this isn't technically a WordPress issue but since it's on a WP project, I'm posting here hoping others have encountered and resolved a similar issue. I've changed the Blog section of a site I'...
0
votes
1answer
684 views

Is it possible to restrict access to specific pages in the admin area based on the page slug?

I would like to restrict access to specific pages in the admin area to only the admin role (and / or specific users). There appears to be no shortage of answers on how to do this using the page ID's - ...
0
votes
2answers
393 views

One off rewrite for single post-type slug (show normal page with same URL instead)

SOLVED See my answer below; I cannot immediately accept it. Original post I made a custom post type of sector: register_post_type( 'sector', array( 'labels' => array( 'name' => ...
1
vote
1answer
139 views

How do you use WP slugs for PDF files / media?

I have hundreds of PDFs that are linked throughout my site, and these PDFs all have a unique document number and revisions. e.g. 902367 version I What I would like to do is have a defined slug for ...
1
vote
0answers
378 views

get_permalink returning site home url instead of the url of slug being passed

I am fetching some testimonials data from db and based on the slugs, I am getting the links to use further. Here is my code function createPageForTestimonials($slug, $title, $content, $companyName){ ...
1
vote
2answers
4k views

how to change a theme slug

I've opted to use the Understrap theme as a base theme for development. How do I safely change the theme slug throughout the theme files, i.e. everywhere understrap appears? Is it simply a case of ...
0
votes
1answer
189 views

Custom taxonomy archive slug overwrites static page

I have created a custom post type, with its own custom taxonomy: $productTaxonomyArgs = [ 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, '...
0
votes
1answer
78 views

Slugs on hierarchical taxonomies

Good day! I found many related questions but somehow I can't apply them to my specific case. I am trying to play around with custom taxonomies and custom post type in order to obtain the following ...
0
votes
0answers
383 views

404 errors problem with multilangual permalink pages

I am suffering an unexpected issue with “Plugin: Qtranslate Slug”; Some of my pages will automatically redirected to 404 error page. I tried a lot of this in slug but the issue is not resolved. This ...
1
vote
0answers
44 views

wp not making CPT permalink / slugs unique

I've registered a custom post type on my site but loads of different users are able to create posts with the same slug / permalink, here is how I am registering my post type // Bucket Custom Post ...
0
votes
1answer
80 views

How can I output the slug of a comment author?

I'm trying to output the slug of the comment author. I'm able to output the username using get_comment_author() but I can'tfigure out how to output the slug. For example, username might be Test User ...
1
vote
0answers
85 views

How to prevent a CPT's slug and page slug from conflicting with each other?

I have a custom post type made and it uses 'slug' => 'treatments’. I also have a page made in the back-end that uses /treatments/, but because I have 'has_archive' => false the page loads fine. ...
0
votes
1answer
487 views

How to modify the slug for the default wp posts without affecting other posttypes?

How can I modify the slug for the default wp posts without affecting other posttypes? example: www.example.com/slug-of-post/ should become www.example.com/blog/slug-of-post/ I made a few custom ...
0
votes
2answers
396 views

Get child-pages slugs of current page into js-file

I'm querying all child pages on my current page with a custom Query like this. <?php $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent' => $...
1
vote
0answers
72 views

Custom Post Slug same as Parents Category Slug

I have removed /category/ slug in my URLs with Yoast SEO and i have category with parent and child i.e: anime chuunibyou anime info in another case, i have a custom post type with slug anime (same ...
1
vote
2answers
146 views

Auto-create a pretty permalink for a bunch of posts

I have spammed many duplicate posts from one initial and now after editing them the url structure for them is something like http://example.com/base-name-copy-20 where base-name is the slug of the ...

1 2 3 4 5 13