WP_Query in functions.php
Simple, you’re addressing $post out of context. When you’re running a standard WordPress loop, WP will load a global $post variable with the results of the current query. This includes the ID, title, content, post meta, etc. The loop functions will reference this global variable to actually give you data. Take the regular function get_the_ID() … Read more