"update_post_meta" check if value is the same before updating? - WordPress Development Stack Exchange

PHOTO EMBED

Wed Jul 20 2022 15:55:35 GMT+0000 (UTC)

Saved by @kalehm

function update_post_meta_check($post_id, $key, $value) {
        $old = get_post_meta($post_id, $key, true);
        if ($old == $value) {
                return false;
        } else {
            return update_post_meta($post_id, $key, $value);
        }
}
content_copyCOPY

https://wordpress.stackexchange.com/questions/318403/does-update-post-meta-check-if-value-is-the-same-before-updating