Reputation: 5311
This is odd...
When I create a page (either draft or published) WordPress does its' job by creating/ suggestion a URL File Name.
For some reason it always appends a '-2' (without apostrophes)
So, for example - /exampleABC/ become automatically /exampleABC-2/
At first I thought it was because there was a draft version of the file or one in existence, but that isn't the case.
I've no idea how best to error-check here - any ideas what I should be looking for? Thanks
Upvotes: 1
Views: 134
Reputation: 26170
The current version of WordPress (version 4.5.1) does not have this "bug". Therefore, one of a few possibilities is happening for you:
Possibility 1: You have slug conflicts.
This is the way that WordPress resolves "slug" conflicts. So - the thing that you have to remember is that ANY record in the posts
table - whether for a page, post, custom post type, etc - and even media - will have a slug. As @McNab points out - this includes the posts (and media) in the trash. If the slug for the page you are creating conflicts with any existing slug, then WP will automatically append a number (and "increment" it as appropriate):
Saving example
- if a post with the slug example
exists, will result in a new slug of example-2
. If example-2
already exists, then example-3
, etc.
Possibility 2: You have a plugin that is causing this issue.
Always keep in mind that plugins can do a LOT, given the power and flexibility of WP, and it's conceivable that a plugin (or your theme) could be causing this.
Possibility 3: Your site is hacked.
Similar to #2, there may be a nefarious / malicious plugin, theme, or "hack" on your site, which is causing this.
However - my strong guess is that it's just possibility 1 - you have other records in the posts
table with the slug already existing.
How to know / prove it?
If I were testing / debugging this, I would take the following steps:
Upvotes: 2