changes to use WP_error for returning errors,adding merge_vars key to accept merge var params