views query alter not working when view appears in sidebar
I think you problem is there that $nid not passed correctly,edit your views, instead of your filter, set filter by contextual filter then in your page passed it by contextual filter parameter with 

$view= views_embed_view('single_job', $display_id = 'block_1', $category);
$view-&gt;set_arguments(array($node-&gt;nid));
$output = $view-&gt;preview();
print $output;


not longer  need query alter function

/*
function bpm_views_query_alter(&amp;$view, &amp;$query) {
  if ($view-&gt;name == 'single_job' &amp;&amp; $view-&gt;display_handler-&gt;display-&gt;id =='block_1' ){
    $nid = _get_job_nid_from_url();
  $query-&gt;where[1]['conditions'][2]['value'] = $nid; 
 }
}*/