How to get a checkbox element inside a metabox, to return its proper value on Post

There are all kinds of code smells regarding why do you want to serialize and sanitize a check box value. The first is not needed, the second is useless when too many wrong values can be “true” as you seem to be ok with a value of “off” as well as “on”

But the main issue in your code is that you do not handle properly the case when the checkbox is not set. You assume that the request always includes you field when submitted but that is not true to checkboxes for which the request will include the field only when it “on” but not when its “off”. Therefor your loop is wrong and you need to explicitly check for your checkbox related field, and clear the value from the meta when it is not set at all in the request. Therefor what is likely to have happened is that you tested that the “on” works and since then the value kept being “on” whatever you have done.

techhipbettruvabetnorabahisbahis forumutaraftarium24edueduedusedusedusedusedusedusedusedu