最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to get the total of two meta values from different meta keys?

programmeradmin2浏览0评论

At post meta I have two meta keys: 'old_views' and 'new_views', so I need a function to get the total value of these both combined and save it as a new meta key called 'total_views'.

For example:

'old_views' = 100

'new_views' = 400

'total_views' = 500

Note: Only the value from 'new_views' will be increment every time a post gets visited. 'old_views' won't be incremented anymore, but I still need to sum both values for old posts published.

发布评论

评论列表(0)

  1. 暂无评论