Thanks for the reply, but this isn't quite what I need. Your plugin relies on knowing what data to filter before the page loads. I need to be able to decide what data to filter as the page is loading. That is, the most important test will be: has my plugin been called? If it's been called, alter the data; if it hasn't been called, don't alter the data.
add_filter seems to get processed before anything gets called on a template. So, if my plugin is called on the template, nothing that I do within my plugin will effect the add_filter function that I set up. I tried setting up a global variable and was losing my mind trying to understand why it wasn't working. I echo'd the variable and the modified $where statement that was supposed to be happening through add_filter and could not understand why my variable was showing up on it's own but not in the function I had set-up through add_filter... until I realized that the add_filter had
happened a long time ago. :)
add_filter cannot, it seems, be called from within a function either. So, I can't have my plugin get called and then have add_filter run then. That would work fine! But it's not possible. :(
What needs to happen:
page loads -> plugin called? -> yes -> grab IDs of posts to display, eliminate all others -> run loop
page loads -> plugin called? -> no -> run loop
The solution, I've discovered, is to use $wp_query->posts and, in my particular instance, was incredibly easy to implement. I was already using $wpdb to make a database call like this:
$all_posts = $wpdb->get_results("SELECT post_title, post_content, post_excerpt, ID, post_password, post_date_gmt FROM $wpdb->posts, $wpdb->post2cat WHERE post_id = ID AND post_status = 'publish'");
If the plan is for the post loop to be effected by the outcome of that database call anyway, this works just as well (and solved my problem):
$all_posts = $wp_query->posts;
Just pass your results back to $wp_query->posts when you're done.