<?php
$attachment_id = get_the_ID();
$title = get_the_title();
$document_permalink = get_the_permalink(get_the_ID());
$pdf_url = wp_get_attachment_url(get_the_ID());


if ($pdf_url) {
	wp_redirect($pdf_url);
	exit();
} else {
	// Si l'URL du document est vide, redirige vers la page 404
	global $wp_query;
	$wp_query->set_404();
	status_header(404);
	get_template_part(404);
	exit();
}
