Beautiful! Why isn’t this in WordPress.org’s documentation? Your solution works far better than the 20 other pages I read while researching this issue.

Thank you much for sharing it!