← All posts
software#software#wordpress#hub-shadow#migration#co-changearXiv:2604.23639

post.php: The Hidden Hub in WordPress

post.php ranks #19 in import graph centrality but #4 in co-change centrality — a rank gap of 15. It is structurally peripheral, behaviourally central. Every migration that ignores this distinction will break.

The File Nobody Watches

In the WordPress wp-includes directory, there are 25 modules. If you rank them by how many other modules import them — the standard structural centrality measure — post.php ranks #19. It is near the bottom. A refactor audit would treat it as peripheral.

Now rank the same 25 modules by how often they change together with other modules (co-change centrality, extracted from 23,000+ commits). post.php ranks #4.

Rank gap: 15 positions.

This is the definition of a hub shadow in IRDME: a node that is structurally peripheral in one layer and behaviourally central in another.


What This Means for a Migration

    The standard migration workflow for WordPress wp-includes is:
  • Audit import dependencies
  • Identify modules with high import centrality (the "core" modules)
  • Migrate those modules first; treat low-import modules as leaf files

Under this workflow, post.php migrates late. It is rank #19 in imports.

But post.php is rank #4 in co-change. That means if you modify anything in the post processing pipeline — post types, post meta, comment handling, attachment logic — post.php changes too. Often silently. If you have already migrated the importing modules without post.php, you now have a version mismatch.

The migration breaks. Not because the architecture was wrong, but because the structural audit was incomplete.


The IRDME Numbers

  • n = 25 modules, 23,000+ commits, 3 layers
  • Pearson r (import_graph ↔ co_change) = 0.5156, p = 0.012 — CONFIRMED
  • Hub shadow: post.php — import rank #19, co-change rank #4
  • The law predicts that import centrality and co-change centrality should correlate across similar layers. With r = 0.5156, p = 0.012, it does. The 24 other modules mostly move together across both rankings.

    post.php is the exception: it has unusually low import rank relative to its co-change rank. This specific rank gap is the signal. The overall law confirmation makes the exception visible — you can only identify a hub shadow if the global correlation is high enough to establish a baseline.


    Why post.php Diverges

    post.php in WordPress does not import many other modules, so it is invisible in the import graph. But it is the central controller for the post object — the fundamental content unit of WordPress.

    Every plugin, every theme, every piece of custom code that touches posts must be compatible with post.php's internal state. Changes to post type registration, post meta APIs, or the WP_Post object ripple through co-change because the downstream code has to adapt.

    This is the structural signature of a behaviour hub: a file whose coupling is implicit — enforced by convention and API contract rather than explicit import statements.


    The Broader Pattern

    post.php is not unique. The IRDME analysis of the Next.js monorepo identifies bundles as a chameleon: import rank #12, co-change rank #2. The mechanism is different (bundles is a build system output layer, not a source layer), but the pattern is the same: the structural audit misclassifies the node.

    In any sufficiently large codebase, there will be hub shadows. Import-only audits miss them by construction. Co-change analysis is required to make them visible.

    Full pre-registered case study: /case-studies/wordpress