I think you will want to connect to the pre_get_posts action . It starts immediately after parsing the query string. Some, but not all, conventions are established. You can check if in_category () is one of them, but I don't think that matters. What for? Glad you asked.
The hook will give you a query object that has a category_name property. All you have to do is check if it has its own category, and if so, run the filter. Something like that:
function ns_function_name($wpq){ if($wpq->category_name == 'work'){ remove_filter('the_content', 'wpautop'); } } add_action( 'pre_get_posts', 'ns_function_name' );
This is completely untested. But since you seem to know what you are doing, this should be enough to put you on the right track.
source share