← ClaudeAtlas

wp-php8-migrationlisted

PHP 8.x migration guide for WordPress — covers PHP 8.0 through 8.3 features, breaking changes, backward compatibility patterns, dynamic properties fixes, and step-by-step migration strategy for themes, plugins, and custom code.
MirAnees/wp-php8-migration-claude-skill · ★ 2 · API & Backend · score 78
Install: claude install-skill MirAnees/wp-php8-migration-claude-skill
# PHP 8.x Migration for WordPress Complete reference for migrating WordPress themes, plugins, and custom code from PHP 7.4 to PHP 8.0, 8.1, 8.2, and 8.3. Covers new features, breaking changes, backward compatibility, and the most common migration patterns. --- ## 1. PHP 8.0 Features for WordPress ### Named Arguments Use with caution in WordPress hook callbacks. WordPress core functions do not guarantee parameter name stability across versions. ```php // BEFORE (PHP 7.4) wp_insert_post( array( 'post_title' => 'My Post', 'post_content' => 'Content here', 'post_status' => 'publish', 'post_type' => 'page', ) ); // AFTER (PHP 8.0) — named arguments in your OWN functions only function register_custom_block( string $name, string $title, string $icon = 'smiley', string $category = 'widgets' ): void { // ... } register_custom_block( name: 'my-block', title: 'My Block', category: 'layout' ); // WARNING: Do NOT use named arguments with WordPress core functions or hooks. // Parameter names may change between WP versions and break your code. ``` ### Union Types for Hook Returns ```php // BEFORE (PHP 7.4) /** @param string|array $classes */ function filter_body_class( $classes ) { ... } // AFTER (PHP 8.0) function filter_body_class( string|array $classes ): string|array { if ( is_array( $classes ) ) { $classes[] = 'custom-class'; } return $classes; } ``` ### Nullsafe Operator for Chained WP Calls ```php // BEFORE (PHP 7.4) $user =