Thank you very much for the detailed explanation. Now I understand what happens, but IMO it shouldn’t be done this way. So it’s not a bug, but a weird, unintuitive behaviour.
Using get_post_meta()
is a good solution. I didn’t even try to use get_post_meta()
because I thought that the value is not saved in the custom field. I thought it’s a bug.
It would be good if it was documented.