Support

Account

Home Forums Bug Reports Multiple Post Objects only returning 1

Solving

Multiple Post Objects only returning 1

  • I checked the database and I’m noticing multiple post objects are saving with delimiter
    ||
    For example, I select 3 post objects and it saves 60||64||72

    I noticed fields/post_object.php is using acf_get_array( $value ); on line 513. I changed this to acf_get_array( $value, '||' ); and it correctly returns all 3 post objects.

    I also notice when there are more than 1 it isn’t showing them on the selector field in the Admin Panel.

  • Post object fields should be storing a serialized array that would look something like this in your database

    
    a:2:{i:0;s:3:"196";i:1;s:1:"2";}
    

    There is likely something that causing the value to be saved in a different format. Start by disabling other plugins and maybe switching to a default WP theme.

  • Hey,

    I had the same exact issue and it was coming from a select2 JS conflict between “ACF Pro” and “Paid Memberships Pro” plugins. Once I used wp_deregister_script on the PMPro enqueue of select2, ACF started to save again as a serialized array. The weird part is it used to work ok until the last ACF update (PRO v5.5.10).

    I know it is not a good solution to deregister JS/CSS of another plugin so there is probably a better solution to fix the conflict.

    I Hope it could help anyone with the same issue.

  • Actually, not that I know of. The problem is that the two plugins are using 2 different versions of select2. In your case the Paid Memberships Pro version of the script was being registered first. The way it works, ACFs later registration of a different version with the same “handle” is ignored. If ACF’s registration were to run first then the other plugins registration would be ignored. What order they happen in has a lot to do with the order that WP loads plugins, and this can be effected by unintsalling, installing, activation and deactivation of plugins.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.