In order to clean a WordPress database, I’m currently attempting to update the post_name
VARCHAR field with an simple incremented value.
After having tested a specific solution given by @gmoliv (I would prefer simple numbers according to selected rows), I tried to adapt this trick given by @gianluca, i.e.:
SET @rownum:=0;
UPDATE wp_posts
SET post_name = @rownum:=rownum+1
WHERE post_status="publish" AND post_type="post"
ORDER BY post_date
Unfortunately, I get an error #1054 Unknown column ‘rownum’ in ‘field list’
Thank you if anyone can enlighten me on this problem.
You are using the MySQL variable as a column name in your UPDATE query.
Before:
After (see line 3):