WooCommerce 10.5 removes AccessiblePrivateMethods: the fix

WooCommerce 10.5 removes the AccessiblePrivateMethods trait. It has been deprecated since 9.6, so the warning has been sitting there for a few release cycles, but 10.5 is the version where plugins that ignored it stop loading.

The AccessiblePrivateMethods trait existed so a private method could be registered as a WordPress hook callback. It lived in an internal namespace, which was the signal that third-party code was never supposed to depend on it. Depending on it now means your store breaks on an update it should have survived.

What changed in WooCommerce 10.5

Rather than using a trait to work around PHP visibility rules, the core team now wants hook-target methods declared public and marked with an @internal PHPDoc annotation. The annotation carries the same intent the trait was there to enforce, and nothing extra has to load at runtime to make it work.

Any extension that still uses the trait throws a fatal error once 10.5 is active. During a routine update that shows up as a white screen, which is why the refactor wants doing before the release lands rather than after.

How to refactor

Remove the trait from the class and change the affected methods from private to public. The @internal annotation still tells other developers the method is not part of your public API, so you lose nothing but the trait itself.

<?php
// Refactored Approach for WooCommerce 10.5
class My_New_Plugin {
    public function __construct() {
        add_action( 'init', array( $this, 'my_internal_logic' ) );
    }

    /**
     * @internal This method is not part of the public API and may change.
     */
    public function my_internal_logic() {
        // Your logic here
    }
}

Checking whether you are affected

Grep your plugins directory for the trait name. Every hit is a refactor to finish before 10.5 ships. The change is small, and the alternative is finding out from a fatal error on a live store.

author avatar
Ahmad Wael
I'm a WordPress and WooCommerce developer with 15+ years of experience building custom e-commerce solutions and plugins. I specialize in PHP development, following WordPress coding standards to deliver clean, maintainable code. Currently, I'm exploring AI and e-commerce by building multi-agent systems and SaaS products that integrate technologies like Google Gemini API with WordPress platforms, approaching every project with a commitment to performance, security, and exceptional user experience.