the_ID()
echoes its value, you can’t use it in that context. Change it to get_the_ID()
.
Many functions in WordPress follow this pattern- one function will print, while the same function with get_
prepended will return its value.
the_ID()
echoes its value, you can’t use it in that context. Change it to get_the_ID()
.
Many functions in WordPress follow this pattern- one function will print, while the same function with get_
prepended will return its value.