1

I'm working on a friends site and I am attempting to update the slug example.com/blah but when I update the slug/url to /blah and click ok it updates it to /blah-2.

This means that there is an existing page/post with this setting. I searched the trash/etc in both pages and posts and I cannot find one. I hopped into the DB to take a look around and I wasn't able to find it either in the DB. Albeit, I'm no pro (beginner in this db schema). Where can I find what page/post has this slug so that I can fix this mess?

DB queries, plugins to help, etc. Thanks!

2 Answers 2

3

The slug is the poorly named post_name column in the $wpdb->posts table. Drop this into your theme templates somewhere-- header.php, for example-- and you should see any posts with a matching slug:

$q = new WP_Query(
  array(
    'post_type' => 'any',
    'name' => 'hello-world',
  )
);
var_dump($q->request);
var_dump($q->posts);

You can tweak the arguments for WP_Query if you feel you need to.

2
  • Excellent help. This helped me figure out what my issue was - using a numeric slug on a page. Commented Apr 28, 2014 at 3:40
  • Great approach!
    – bramchi
    Commented Mar 28, 2022 at 17:24
0

I found my issue. I was attempting to use a numeric slug for a page which is not allowed. See - Can I use a number for a post/page slug?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.