Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
Wordpress

WordPress: Fix Author Bylines That Show the Wrong Name After Migrating Users to a New Database

- 03.10.26 - ErcanOPAK

🔧 The Byline That Followed the Wrong Author Home

Migrating a WordPress site to a new database – a new host, a staging-to-production move, a restore from a backup taken on a different server – and finding posts now crediting the wrong author is rarely about the post content being altered at all. WordPress stores a post’s author as a numeric user ID, not a name, and every post simply looks up whichever user currently has that ID to decide whose byline to show; if the new database’s wp_users table assigns IDs in a different order (a fresh WordPress install’s default admin account taking ID 1, for instance, when the original site’s ID 1 belonged to a completely different person), every post written by the original ID 1 now displays whoever happens to hold that same number on the new installation.

🔎 The Problem

-- Original site: ID 1 = "Jane Editor", who wrote most of the posts
-- New install (migrated separately, users re-created manually):
-- ID 1 = "admin" (WordPress's own default first-created account)

-- Every post's byline is driven by this stored reference, not by
-- a name:
SELECT ID, post_title, post_author FROM wp_posts LIMIT 3;
-- post_author column holds a raw user ID - "1" - with zero
-- indication, from the posts table alone, of which actual person
-- that number was supposed to mean on the ORIGINAL site.

-- The byline shown on the front end is purely a live lookup:
SELECT display_name FROM wp_users WHERE ID = 1;
-- "admin" - and every single post stored with post_author = 1
-- now credits "admin" instead of Jane, with no content on any
-- individual post actually having changed at all.

✅ Fix: Re-Point Each Post at the Correct User ID on the New Database

  • Checking the original site’s wp_users table (from a backup, or the old live site if still accessible) to build a clear mapping of ‘old user ID -> person’s actual name’ is the essential first step – without that reference, there’s no way to know which ID a given post was really supposed to credit.
  • Using a plugin built for bulk-reassigning post authorship (many admin-UI options exist, letting multiple posts currently attributed to one user ID be reassigned to the correct one in bulk) avoids editing post_author values directly in the database, which is faster to get wrong than to get right by hand.
  • For a one-time migration cleanup, carefully running a direct UPDATE against wp_posts.post_author (matched against the specific old-ID-to-new-ID mapping built in the first step, and only after a fresh backup) corrects every affected post in one pass rather than one at a time through the admin UI.

⚠️ Why This Is Easy to Miss During a Migration

  • Nothing about a mis-attributed byline throws an error or looks broken on the page – it’s a completely valid author showing a completely valid name, just not the one that post was actually written by, which means this specific kind of mistake is caught by a human noticing, not by anything automated.
  • User accounts are very rarely migrated with the same care taken for post content and media – it’s common for the people doing a migration to re-create user accounts manually on the new site without preserving the exact same ID-to-person mapping the old site had, which is precisely the gap this bug lives in.

WordPress never actually forgets who wrote a post – it just remembers them by a number, and a migration that changes what that number means changes every byline in the database at once.

— WordPress Best Practice

Related posts:

WordPress: Fix a Block Theme's theme.json Settings That Get Replaced Instead of Merged Because the C...

WordPress: Fix a Block Theme's theme.json Settings That Get Replaced Instead of Merged Because the C...

WordPress: Recover a Site After an Auto-Update Breaks the Admin Dashboard

WordPress: Recover a Site After an Auto-Update Breaks the Admin Dashboard

WordPress: Master Hooks (Actions & Filters)

WordPress: Master Hooks (Actions & Filters)

Views: 8

Post navigation

Photoshop: Recover a Saved Path That Vanishes From the Paths Panel After a Crash
The AI Prompt That Finds Every API Endpoint Missing Input Validation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,068)
  • Get the User Name and Domain Name from an Email Address in SQL (990)
  • How to add default value for Entity Framework migrations for DateTime and Bool (986)
  • Get the First and Last Word from a String or Sentence in SQL (865)
  • How to select distinct rows in a datatable in C# (859)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (661)
  • Add Constraint to SQL Table to ensure email contains @ (619)
  • Average of all values in a column that are not zero in SQL (577)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (553)
  • Find numbers with more than two decimal places in SQL (481)

Recent Posts

  • Network Speed Monitor Windows Application v2.5.1
  • Ağ Hızı İzleyici Windows Uygulaması v2.5.1
  • How to make theater mode the default for Youtube
  • The AI Prompt That Audits a Function for Thread-Safety Gaps
  • Ajax: Fix a Fetch Request Caching a Response Despite No-Store
  • WordPress: Fix a Navigation Block Losing Submenu Items After Sync
  • Visual Studio: Fix CodeLens Reference Counts Stuck at Stale Numbers
  • C#: Fix a UTF-8 String Literal Behaving Differently in a Switch
  • Photoshop: Fix a Liquify Mesh Snapping Back on a Smart Object
  • The AI Prompt That Turns a Crash Dump Into a Short Repro Script

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,068)
  • Get the User Name and Domain Name from an Email Address in SQL (990)
  • How to add default value for Entity Framework migrations for DateTime and Bool (986)
  • Get the First and Last Word from a String or Sentence in SQL (865)
  • How to select distinct rows in a datatable in C# (859)

Recent Posts

  • Network Speed Monitor Windows Application v2.5.1
  • Ağ Hızı İzleyici Windows Uygulaması v2.5.1
  • How to make theater mode the default for Youtube
  • The AI Prompt That Audits a Function for Thread-Safety Gaps
  • Ajax: Fix a Fetch Request Caching a Response Despite No-Store

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com