Home › Forums › Front-end Issues › Find Sum of Custom Field Values from Different Posts › Reply To: Find Sum of Custom Field Values from Different Posts
One of the answers on this page explains how to do this http://wordpress.stackexchange.com/questions/9394/getting-all-values-for-a-custom-field-key-cross-post, it’s the last one on the page right now posted by
The problem with the his however, as that poster says, there isn’t any way to not get values from revisions, trash, or all other types of posts.
The only way to do this accurately it do use WP_Query to get all of the posts in your post type, loop through them to get all of the values and then add them together.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.