So, kind of a silly error on my part.
I needed to call my function from a place that had access to the variables I needed (such as the post ID). Using the following hook worked well:
add_action('the_post', 'add');
So, kind of a silly error on my part.
I needed to call my function from a place that had access to the variables I needed (such as the post ID). Using the following hook worked well:
add_action('the_post', 'add');