Support

Account

Home Forums General Issues Comparing get_fields() with $_post['acf'] orders are flipped Reply To: Comparing get_fields() with $_post['acf'] orders are flipped

  • Thank you for your reply.

    Because I wanted some sort of custom order and not have it completely random, I created this function

    https://gist.github.com/mvaneijgen/f169750f01f3677ccda34d12dd89dc93

    I would just like it to share and have this issue resolved. What I did was create a list of fields I wanted to see in the email (not all the fields are relevant) and have them in the order seen in the array $arrayKeysOldItems next I compared the $_post['acf'] array stored in $arrayKeysNewItems and had them ordered the same as the previous array. Than I just looped through all the items in the first array and compared them with the values of the new array and if they were different I add them to the email.

    In my final code I also do some converting of sting to date and time stamps because not all the values are in the same way stored, but that would just clutter up this code.

    Thanks again for your feedback! Seems like a much easier solution!