DEV: do not append/prepend if callback returns nothing (PR #9778)

GitHub