Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

A few lowercase words separated by dashes, describing a post and usually derived from the post title to create a user-friendly (that is readable and without confusing characters) permalink. Post slug substitutes the `%posttitle%` placeholder in a custom permalink structure. Post slug should not be ...

0
votes
0answers
4 views

Duplicate category slugs from pages and posts

We are working in a new website and having issues with duplicate categories slugs from "posts" and "pages". We are trying to develop the same structure of this website: https://coconuts.co. We ...
0
votes
1answer
15 views

how do prevent wordpress from creating permalinks for media files

Could one please explain how can I prevent WordPress 4.9 from creating permalinks/slugs for Media files without the need of installing another plugin? It's also important that the solution won't get ...
1
vote
1answer
22 views

How to get the post name (slug) from the item ID when traversing the navbar?

I'm working on a filter for nav menu items, such as add_filter('wp_get_nav_menu_items','nav_items', 11, 3); function nav_items($items, $menu, $args) { foreach ($items as $item) { $slug_1 =...
0
votes
0answers
29 views

Unable to replace custom post_type slug by the publish_post. But the save_post is working properly (wp_update_post)

I would like to update the_title when saving the events every time. And the slug when publish new events only. <?php function set_title_on_save( $post_id ) { $post_type = get_post_type($...
0
votes
0answers
20 views

Removing CPT slug from URL results in 404 error for archive page

I have created a CPT with rewrite rules as follows: "rewrite" => array( "slug" => "/", "with_front" => false ), In the functions.php, I have added the following code: function ...
1
vote
1answer
48 views

Taxonomy page returns 404 page not found

I have a custom post type and one custom taxonomy registered for it. The custom post type is called "memory-cards" and the taxonomy is "lesson".For this taxonomy I have create two terms "english" and ...
0
votes
1answer
33 views

I've removed my /author/ slug but it clashes with new and existing pages. Any fixes?

I've successfully removed my author slug using this tutorial: https://wp-snippet.com/snippets/remove-author-prefix-from-slug/ so it's like website.com/author/cixxy to website.com/cixxy My question ...
0
votes
1answer
25 views

Display a custom slug in URL depending on user variable

Sorry if this has been asked - I haven't figured out how to search it in a way that leads me where I want to go. We have a client who wants a site built that represents four geographical areas and so ...
3
votes
1answer
61 views

How do I use the same post slug for different Categories?

I want to use the same post slug for different categories. Because I will have different projects with the same slug. I already have the post slug email. The second slug email becomes email-2, but I ...
0
votes
1answer
21 views

how to get category`s slug in WP_Query loop?

i use below code : //custom post = project //taxonomy = project-category $args = array( 'post_type' => 'project', ); $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() )...
1
vote
1answer
21 views

How to show posts with multiple tags on tag.php?

On my tag.php page, I want to show posts with multiple tags... I have something like this: mypage.com/tag/tag1+tag2+tag3/ $tags = get_queried_object()->slug; //returns only 'tag1' !! $args =...
2
votes
3answers
51 views

How I Can Use The Get Value as A Slug

in my single.php i took a data from one $_GET[] value and i'm using this like domain.com/example-slug/?holder=value The thing i want is domain.com/example-slug/value or domain.com/example-slug/...
2
votes
2answers
77 views

Why don't WordPress post slugs allow accents?

If you create a post whose title has an accent in it and some other unicode character in it, eg à 漢語 title thing, its slug (permalink) will become a-漢語-title-thing... ie, the à was converted into a ...
1
vote
1answer
24 views

Programmatically rewriting slug through functions.php but returns 404

I wanted to change the slug of a certain post type (in this case, article) into whatever a certain value in its custom field. I went to functions.php and put this code. function na_remove_slug( $...
0
votes
0answers
53 views

Remove base slug from custom taxonomy url

I have created a CPT and have removed its base url slug using the following code: /** * Removing Slug from CPT */ function remove_slug( $post_link, $post, $leavename ) { if ( 'cpt_slug' != $...
0
votes
1answer
32 views

Matching slug terms from one array to those in array of WP_Term objects to output term names

I'm using WordPress's get_terms to return an array of WP_Term objects containing the term_id, name, slug, etc. for the child terms of a given taxonomy. I've saved this array to $tax_terms. I have a ...
2
votes
1answer
111 views

Duplicate Category and Page URL loads Category instead of the Page

I have created a Category with the slug service, which has the permalink: https://example.com/service. and a Page with the link: https://example.com/service. In the Category service, there is a post ...
0
votes
1answer
45 views

Does WordPress automatically redirect url without parent slug?

I inherited admin duties for my organization's site. Ive noticed that if I enter a url with a child slug only (and drop the parent) it seems to redirect to the full url. Ex: www.example.com/child-...
0
votes
1answer
16 views

Change permalink incrementor into pseudo-subdirectory

how I can change permalink from www.mydomain.com/lyrics/title www.mydomain.com/lyrics/title-2 www.mydomain.com/lyrics/title-3 to www.mydomain.com/lyrics/1/title www.mydomain.com/lyrics/2/title ...
0
votes
0answers
16 views

Prevent user to publish article based on slug

I am looking for a plugin/code to fix wordpress slug issue. Current behavior is if we have an existing article ... example: /selling-a-computer/ And we create another article and give it the same ...
1
vote
1answer
260 views

How to rewrite slug of custom post type archive page

I have a CPT called "case-studies" and the slug of the archive page of this cpt is www.my-domain.com/case-studies and the slug of the ctp posts is www.my-domain.com/case-studies/case-study-name. Now, ...
1
vote
1answer
29 views

Create a custom php page and load it at a specific slug

I have this painful problem with a client. They need to load a feed from a remote endpoint into a page that fits their WordPress template design.. They also want to display the page at a particular ...
0
votes
1answer
329 views

Remove /product/ from url. I want only category name then product name

I have a site https://abc/product/accessories/beanie/ But I want this https://abc/accessories/beanie/ Mainly I have to remove /product/ (/shop/) from url. Using this I got right permalink but ...
0
votes
1answer
108 views

How to change a Wordpress term's slug before saving

We are using WP All Import to import product data from a CSV into WooCommerce. Everything works fine (great plugin!) but we have one problem: Two of our product attributes contain disallowed symbols: ...
0
votes
0answers
22 views

How to have theme auto add Slug to custom post type?

I AM A NEWBIE SO BARE WITH ME I have a wordpress movie them which i did some custom edits to and its working fine. But i am trying to automatically add slug (seasons & episode slug) to a custom ...
1
vote
0answers
47 views

Sort order by slug for looped child terms of custom taxonomy

I have page that displays multiple carousels that contains the posts for each child term of parent taxonomy: projects for the custom taxonomy: portfolio-categories for CPT: portfolios. When Portfolio ...
1
vote
1answer
45 views

Custom Post Type with Same Page URL

I have set up a page with the URL slug "announcements" I also have a custom post type with the rewrite set to the same name: 'rewrite' => array('slug' => 'announcements'), This all works fine....
3
votes
2answers
258 views

Exclude specific slug in 'get_terms'

I have a custom taxonomy "role" for my custom post type "People". When listing the roles, is there a way to exclude roles based on slug and not ID via get_terms function? I ask because I'm running ...
0
votes
1answer
92 views

Delete Redirect Slug For Specific Post

I have a couple of posts that are getting hammered by bots so I want to change the permalink slugs. However, when I do so WP redirects from the old to the new slug. I want the old slug to give a 404. ...
1
vote
0answers
54 views

Best way of removing emoji support from url / slug only

Couldn't find anything on the topic. I guess something could be done with the 'wp_unique_post_slug' filter but how would I go about just removing the emojis from the slug? I've tried all kinds of ...
0
votes
0answers
17 views

Use default permalink for custom post (and no slug) [duplicate]

I'v created a custom post type with this code : register_post_type('Villes', array( 'labels' => array( 'name' => __('Villes'), 'singular_name' => __('...
1
vote
1answer
15 views

Stop / prevent WordPress from updating permalinks of custom post type

I have a WordPress installation with a custom post type with a whole bunch of posts. These posts all have a unique permalink which is being generated by FileMaker and synced with WordPress. This ...
0
votes
0answers
22 views

Wordpress adding -2 to the slug of every new post

This is a weird one. I get that WordPress adds -2 to duplicate posts even if that post isn't in the trash and is stuck in the database. But, I am getting an error where every new post I create, if I ...
0
votes
0answers
15 views

How to make WordPress create a query based on a slug?

How to make WordPress create a query based on a slug ? For example I have my wordpress site url as http://example.com/. I want to generate a page based on the slug provided on the url. This is a ...
1
vote
1answer
97 views

Does rename of page slugs create 301 redirects from old slug to new (same as for posts)?

Does rename of page slugs create 301 redirects from old slug to new (same as for posts)? Starting a fresh install of wp wordpress:4.9.4-php7.1 I'm trying to get automatic redirects for renamed page ...
0
votes
1answer
13 views

Change the full slug for a specific category?

I have multiples categories on my post: /category/blog /category/sports …And so on. I also have /category/news I'd like to change this category url to simply have /news without the /category. How ...
0
votes
0answers
20 views

Have different Post Archive Slug to Post slug?

I have 2 Custom Post Types in 1 archive page. $args = array( 'post_type' => array( 'event', 'news' ) Page works fine, both CPTs link to there correct posts. I want my archive slug to be '...
0
votes
0answers
54 views

Using %postname% permalink structure on posts with no title to not append -2

My Permalink structure uses just /%postname%/. When I publish a new blog post, it looks like: https://example.com/slug-goes-here I want to keep this structure as I prefer it for both pages and posts....
0
votes
1answer
13 views

Wordpress numeric (yearly) page names / disable yearly archives

I need to achieve page structures on website that is http://pagename.example/2017, http://pagename.example/2018 .. etc Now wordpress rename my page slugs to 2017-2, 2018-2 because WP use those ...
0
votes
0answers
27 views

Can't use Persian/Farsi in Author slug (returns 404)

I have modified author links to show nickname instead of username, using this tutorial. It works correctly with English names, but when I use Persian, it returns a 404. What's wrong? I've also tried ...
0
votes
1answer
25 views

WordPress Reserved Terms, any workaround?

I noticed that "embed" is part of "reserved terms" so it automatically change my slug in embed-2. There is any solution to force it to "embed"?
0
votes
1answer
68 views

Exclude a category slug on pagination

I'm a beginner of wordpress ... I'm creating my first template and I would like to exclude the category "portfolio" from pagination. I tried in every way, but I managed to do just the opposite, browse ...
0
votes
0answers
37 views

fix slugs containing invalid characters?

On a site I support, there are a lot of urls containing seemingly invalid characters (e.g. brackets, commas etc) which cause 404s in Google. e.g. http://www.anorak.co.uk/167259/news/those_who_cant,...
0
votes
0answers
9 views

how to change slug name without affecting the post items

I have facing a issue in slug name. I have replaced a taxonomy Testimonial into Products.I forget to replace the slug name of the existing one. which is testimonial-view. now the url of the product(...
0
votes
1answer
40 views

add .html to custom post type with WPML

( i open a new question since i found why my slug don't translate in generated links, sorry if it is an error, but sounds logical for me ). so i use WPML and Custom Posts Type on my wordpress. i ...
0
votes
3answers
136 views

How do I get slug of all active plugins programmatically?

I want to check plugin version using following API https://api.wordpress.org/stats/plugin/1.0/{slug} For that how can I get Slug of All Active Plugins ?
0
votes
1answer
265 views

Divi change project slug based on category

My first help-question here :) Using Divi theme, i found that Project custom post type let you add your portfolio projects, while having PROJECT slug in the URL. The web is full of tutorial about ...
0
votes
1answer
59 views

Automatically update slug with latest title within custom post type [duplicate]

I'm trying to update the slug for all the post within a specific custom post type, let's say "music". Here is the code: /* Update slug with the latest post title */ function auto_update_post_slug($...
1
vote
1answer
123 views

Using page slug in array

I want to use the page slug as the taxonomy when calling a list of custom posts. This works: <?php $page_slug = basename(get_permalink()); ?> <?php echo $page_slug; ?> It shows "...
0
votes
2answers
66 views

generate random slug when adding taxonomy

I have created a custom post type called 'reports' to provide an easy method for providing monthly reports to specific people. I don't want users to have to login to view the reports and I also don't ...