How do I change my Post ID on WordPress?

jeiss

New member
Joined
Jul 19, 2017
Messages
36
Points
0
A post id is a unique number given to a particular item (post) on a website. Most web pages have a unique post id that distinguishes them from other pages. I ran into a bit of a trouble while doing some page modifications on my site. I accidentally deleted a page which was an important traffic source for me. I want to make a similar page and use the previous post id for it.

Does anyone know how I can edit my post id?
 

ron13315

Member
Joined
Jul 23, 2014
Messages
280
Points
18
changing post ID in wordpress is a bad idea,

I assume that your are using plain option in permalink that displaying your post id like this --> yoursite.com/?p=123

Its better to use postname in permalink also good for SEO, something like this --> yoursite.com/sample-post

check your settings > permalink
 
  • Like
Reactions: Mr.Juan

jeiss

New member
Joined
Jul 19, 2017
Messages
36
Points
0
jeiss
Yes I am. I thought this doesn't affect SEO and hat matters most is the content therein. Could I have misjudged that fact?

I'll give it a try and get back to you soon. I hope it tuns out the way I want it. This whole ish is giving me a headache.
 

Marc van Leeuwen

Premium Member
Joined
May 29, 2016
Messages
1,047
Points
63
Does anyone know how I can edit my post id?
For any reasons, you are wanting to change post id for a specific post on your Worpress blog then it is possible to do that by open your phpmyadmin from your web hosting control panel
and finding in the wp_posts table

change-post-id-in-Wordpress.png

Click on Edit and type a number as you wanted.

change-post-id-in-Wordpress-1.png

Keep in mind that that number is unique and not same as other ID in that table.

Hope that helps!
 

ron13315

Member
Joined
Jul 23, 2014
Messages
280
Points
18
Yes I am. I thought this doesn't affect SEO and hat matters most is the content therein. Could I have misjudged that fact?
seo friendly url or link contain keywords that explain the article, and they’re easy to read by both humans and search engines.
 

vishwa

Well-known member
Joined
May 12, 2014
Messages
1,130
Points
63
First of all when you accidentally deleted the post, It will moved to trash section, have you checked it? or you have already empty the trash? if yes than there is no way to restore it. You can create a new post with same title and content and use custom Permalink structure. It will automatically get indexed by Google.
 

ryo ionut

New member
Joined
Jul 31, 2017
Messages
10
Points
0
As far as I know the post ID is sequential and numerical, and cannot be changed from that format.
If you raised this because you are looking to update the url structure you can do so in Permalinks Settings.
 

Dopani

Active member
Joined
Mar 11, 2014
Messages
315
Points
28
Dopani
I agree a bit more with you but as I knew Post ID can be changed directly on database but take care on that because they have relationships together, between tables in a database so if you change post ID then need to change related ID on other tables and make sure that ID on all tables is updated.
 

fxtriangle

New member
Joined
Apr 1, 2021
Messages
2
Points
0
The simple way to change to some ID would be to just create a new post and copy data over (through admin or with code either). Post ID of a post also reflect in tables other than Post table, like post comments table
 

morissyn

New member
Joined
Aug 18, 2021
Messages
16
Points
1
I agree that the easiest way out of the situation is to copy the page and create a new one. In any case, it will be indexed by Google and soon added to the search engine queries.
 

morissyn

New member
Joined
Aug 18, 2021
Messages
16
Points
1
To change the post ID, you need to directly edit this number in the database - you can do this with phpMyAdmin. Open phpMyAdmin, select the database used for your site and go to the SQL tab. Run the following query:
UPDATE wp_posts SET ID= NEW_ID WHERE ID=OLD_ID;
OLD_ID is the current post ID you want to change
The NEW_ID is the ID you want to change the old one to
Example:
UPDATE wp_posts SET ID=185 WHERE ID=180;
185 is the new post ID, 180 is the old post ID.
 
Newer threads
Replies
8
Views
3,592
Replies
0
Views
3,391
Replies
0
Views
5,440
Replies
6
Views
3,176
Recommended threads
Replies
4
Views
3,115
Replies
4
Views
2,219
Replies
4
Views
4,018
Replies
0
Views
2,306
Replies
3
Views
1,047

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top