an action hook when a post reaches a certain number of views
Use the action from update_post_meta(): do_action( “updated_{$meta_type}_meta”, // example: updated_post_meta $meta_id, $object_id, // post ID $meta_key, // ‘view’ $_meta_value // view count ); Something like this should work (not tested): add_action( ‘update_post_meta’, ‘badge_check’, 10, 4 ); function badge_check( $meta_id, $post_id, $key, $value ) { if ( ‘views’ !== $key or 1000 > $value ) return; … Read more