Please revise to check that `$post->ID` exists and if not, set to `null` or use a null variable.