Added check for post visibility to fix #819.