WP-2231: Limit terms by depth and sort properly.