added query_build_hook function for plugin