Vai al contenuto Vai alla barra laterale

Resolved

Reported for: Advanced Custom Fields Multilingual 2.0.5

Resolved in: Advanced Custom Fields Multilingual 2.2.0

Topic Tags: Compatibility

Overview of the issue

Under some scenarios, Advanced Custom Fields Multilingual (ACFML) plugin may run into a PHP warning when utilizing ACF fields:

Attempt to read property "post_content" on null in plugins .../acfml/classes/class-wpml-acf-repeater-shuffle.php on line 249

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open …/acfml/classes/class-wpml-acf-repeater-shuffle.php file.
  • Look for line 244.
  • Replace:
    	private function isChildOfRepeaterField( $key, $postId ) {
    		$acfFieldObject = get_field_object( $key, $postId );
    		if ( isset( $acfFieldObject['parent'] )
    			 && $acfFieldObject['parent'] > 0 ) {
    			$fieldParent        = get_post( $acfFieldObject['parent'] );
    			$fieldParentContent = maybe_unserialize( $fieldParent->post_content );
    			if ( isset( $fieldParentContent['type'] ) && 'repeater' === $fieldParentContent['type'] ) {
    				return true;
    			}
    		}
    		return false;
    	}
    
  • With:
    private function isChildOfRepeaterField( $key, $postId ) {
        $acfFieldObject = get_field_object( $key, $postId );
        if ( isset( $acfFieldObject['parent'] ) ) {
            if ( is_numeric( $acfFieldObject['parent'] ) && $acfFieldObject['parent'] > 0 ) {
                $fieldParent = get_post( $acfFieldObject['parent'], $postId );
                if ( $fieldParent ) {
                    $fieldParentContent = maybe_unserialize( $fieldParent->post_content );
                    if ( isset( $fieldParentContent['type'] ) && 'repeater' === $fieldParentContent['type'] ) {
                        return true;
                    }
                }
            } elseif ( is_string( $acfFieldObject['parent'] ) ) {
                $fieldParent = get_field_object( $acfFieldObject['parent'], $postId );
                if ( isset( $fieldParent['type'] ) && 'repeater' === $fieldParent['type'] ) {
                    return true;
                }
            }
        }
        return false;
    }
    

8 risposte a “Advanced Custom Fields Multilingual (ACFML): PHP Warning - Attempt to read property "post_content" on null”

    • Thanks for your feedback. Some fixes can take longer due to complexity, prioritization, or because a workaround is available in the meantime.

  1. I just ran into this issue, fixed it myself and reported the fix through your support forum. A member of your support team replied and pointed me to this errata. If you literally have a fix ready for nearly 2.5 years, why not just add this into the next version and be done with it?

  2. It’s February 2026 and i’m still getting this message. Can you please put i a hotfix rather than waiting for a release? This is incredibly unusual from a plugin vendor i’ve never seen a recommendation to esit plugin files directly, or a simple fix take over a year to issue.

    • Hi Tom,

      Thanks for your message. We’ve just released ACFML 2.2.0 today, which includes a fix for this problem. Could you please update the plugin and let us know if everything works as expected on your end?