• Resolved ig_communitysites

    (@ig_communitysites)


    Definitely appears to be a conflict between SNAP and Advanced Custom Fields, which causes ACF fields not to be saved when a post is published.

    We’re using SNAP 4.1.1 and ACF Pro 5.6.7, with posts being published to Facebook. If we create and publish a new post, none of the ACF custom fields are stored; that appears to happen whether or not the post is actually being published to Facebook. The fields in question include standard text fields, so nothing special.

    If I deactivate SNAP, ACF goes back to working correctly. So SNAP is definitely the culprit.

    From tracing through the code, it appears that the problem is in this function: nxs_removeAllWPQueryFilters which is called by nxs_snapPublishTo. Specifically, it’s with the removal of the ‘posts_where’ filters which presumably ACF needs to be able to find its fields and save its data.

    Any ideas, please?

Viewing 1 replies (of 1 total)
  • Thread Starter ig_communitysites

    (@ig_communitysites)

    Given the lack of a response, I’ve had to apply a hack to solve this issue. For what it’s worth, this is the revised code:

    function nxs_removeAllWPQueryFilters() { remove_all_filters( 'posts_orderby' ); remove_all_filters( 'posts_where' ); remove_all_filters( 'posts_fields' ); remove_all_filters( 'posts_clauses' );
      remove_all_filters( 'posts_distinct' ); remove_all_filters( 'posts_groupby' ); remove_all_filters( 'posts_join' ); remove_all_filters( 'post_limits' );
      
      global $acf;
      if ($acf) 
        add_filter('posts_where',        array($acf, 'posts_where'), 10, 2 );
    }

    …so that reinstates the ACF filter. It seems very questionable to simply remove all of those filters without any consideration for what they might be doing, so I’d hope that a future update might take a more subtle approach and that we’d therefore be able to remove that hack.

Viewing 1 replies (of 1 total)
  • The topic ‘Conflict with Advanced Custom Fields Pro’ is closed to new replies.