Gonçalo Loureiro
Gonçalo Loureiro

Reputation: 369

Wordpress Page URL Slug

Hi have the page 2825 with url slug 2825-2 and i cant change for 2815(only) how i can change?

Upvotes: 0

Views: 2805

Answers (3)

Dedering
Dedering

Reputation: 423

The post ID is an auto incremented primary key in the database so you will not be able to roll it back.

Your best bet might be to look into a different permalink structure.

Upvotes: 0

FluffyKitten
FluffyKitten

Reputation: 14312

There are a number of reasons this could be happening, not just because you already have a post or page with this slug:

  1. Check your Trash:
    Make sure that all posts/pages/categories/etc have been deleted and are not sitting in your trash - if a post is still in trash, WP still treats the slug as in use.
     
    You could use a plugin such as Bulk Delete to easily delete all trash.

After it has been deleted permanently from trash:

  1. Flush your Rewrite Cache:
    There are Three Ways to Flush the Rewrite Cache in WordPress:

    • re-save your permalinks in the Admin
    • call flush_rewrite_rules(); in your functions.php (only add it temporarily - you don't want it to run all the time).
    • delete the cache from the database: Run the following query in the database:
      SELECT * FROM wp_options WHERE option_name = 'rewrite_rules'
      You should only get 1 result - edit it to remove the option_value. See Three Ways... for more info.
       
  2. Delete old WP permalinks
    If its still not working, run this query in your database to clear all the old slugs from the postmeta table:
    DELETE FROM wp_postmeta WHERE meta_key = '_wp_old_slug';

    Ref 'Remove Old Permalinks?'

Note: Back up your database before you make any changes in there directly - any mistakes could break your site.

Upvotes: 2

kazzi
kazzi

Reputation: 534

You can't change the URL to just be /2815 because there already exists a page, post, or category with the slug. That is why it added the '-2' to the end of the URL.

I would find that page and either update or delete it, then change the URL with the -2 to just be 2815 instead of edit it from the backend to cause a conflict with the existing page, post, or category

Upvotes: 0

Related Questions