Update slug (URL) of pending posts via phpMyAdmin

One disadvantage of using that SQL query is that the slug will only be updated when you really go edit the post. Plus, it might cause odd behavior when any plugin tries to do something with an empty slug.

A good alternative would be to use WP-CLI instead.

First, you’ll need a list of all pending posts:

wp post list --post_type=post --post_status=pending --format=ids

Next, you need a way to remove the slug of a post:

wp post update <id> --post_name=""

Now you can combine these commands like this:

wp post update $(wp post list --post_type=post --post_status=pending --format=ids) --post_name=""

This way, the post update will happen through WordPress’ internal API instead of just SQL.

error code: 523