How can I redirect anonymous user to 404 rather than 403?

I have some content I want to ‘hide’ (as opposed to publish/unpublish) from anonymous users.

The last dev on this project has made a check box ($hidden_value) to do this already, but it’s redirecting to 403. Their code goes something like:

$access = !$hidden_value['value'] ? user_access('access content') : !user_is_anonymous();

I want to make this redirect to the 404 page and so within hook_preprocess_page() I added:

  if ($access === FALSE) {
    drupal_not_found();
  }

but this does not seem to work – It still redirects to 403. I also tried drupal_exit to the same result.

Would anyone know what I can do to fix this?

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed