searchterms-tagging-2 как раз сделает что тебе нужно ... ничего допиливать не нужно ... сразу для WP
из описания ...
Цитата:
Multiply blog traffic by strengthening on page SEO, increasing the number of indexed pages, auto convert search terms into post tags, and more. With displaying incoming search terms linked to your blog posts from single post and side wide sidebar.