How to Migrate from WordPress to Custom Code
The short answer: export the content through the WordPress REST API or XML export, convert it to Markdown or a headless CMS by script, self-host the media, replace each plugin with what it actually did, keep every permalink or 301-redirect it, and copy titles and meta descriptions from your SEO plugin. For a B2B marketing site this usually takes 2 to 4 weeks.
Why B2B teams leave WordPress
- Maintenance. Core, theme and plugin updates every month, and a plugin conflict after each one.
- Security. A database and admin login on the public site are the most common target.
- Speed. Page builders and plugin scripts slow pages down.
- Publishing friction. Page builders that only one person understands.
A static custom site removes the database, the admin login and the plugins. Content still lives in a CMS the team can edit.
Step 1: Inventory
Crawl every URL, including category, tag, author and date archives, attachment pages and paginated pages. Save title, meta description, canonical, H1 and structured data for each. List custom post types, custom fields, menus, forms and plugins. Export 12 months of Search Console data.
Step 2: Export content
- Use the REST API (
/wp-json/wp/v2/) for posts, pages, custom post types, taxonomies and media, or the XML export under Tools. - Pull titles, meta descriptions and canonicals from the SEO plugin’s fields. The theme’s output is often different from what the plugin stores.
- Download the media library and rewrite image URLs to the new paths.
- Convert content to Markdown or your headless CMS’s format. Shortcodes and page-builder blocks need a rule each.
Step 3: Replace plugins
| Plugin type | Replacement |
|---|---|
| SEO plugin | Metadata and JSON-LD in the templates |
| Forms | Hosted form or a serverless function |
| Caching, CDN, security | A static host |
| Page builder | Components and a content model |
| Redirect manager | The host’s redirect file |
| Analytics, consent | Script tags loaded after consent |
Step 4: Rebuild templates
Build each page type once in Astro or Next.js. Most WordPress marketing sites need fewer templates than they have: the inventory shows which pages share a layout.
Step 5: Permalinks and archives
Keep the permalink structure, including or excluding date folders and trailing slashes exactly as today, or map each URL to a 301. Decide what happens to tag, author and date archives: keep the ones with traffic, redirect the rest to the closest category or the blog index. Redirect attachment pages to the file or the parent post.
Step 6: Parity and launch
Crawl the staging site (set to noindex), compare it with the baseline URL by URL, test forms and analytics, then switch DNS. Submit the sitemap and check Search Console daily for two weeks.
How Allsite can help
Allsite is a design and development studio for marketing websites. We move WordPress sites to custom code, Webflow or Framer at a fixed price, typically in 2 to 4 weeks. See the full website migration process, website migration or request a project.