How to display the current and parent category in WordPress
Need to show the category hierarchy in your theme? Learn how to get the current category and its parent using get_the_category() and get_category_parents().
Most PHP applications log in two ways. The web server and PHP write errors, and the application, if someone planned it, writes an audit trail of what users did. The CNIL recommendation on logging is about the second kind. My name is Mariusz Szatkowski and I develop from Gdynia, remotely and in writing. For Lyon projects I use the recommendation as a design brief for the audit trail and as a reason to review what the error log contains. I am not a lawyer, so the controller and its adviser decide what applies.

Hôtel de Ville, Lyon, from the Terreaux gallery. Image: Romainbehar, public domain (CC0), via Wikimedia Commons.
Deliberation no. 2021-122 of 14 October 2021 adopts a recommendation on the retention and use of logging data. The Légifrance text, published in the Journal officiel of 30 October 2021, says it is neither prescriptive nor exhaustive. It rests on the GDPR, on the law of 6 January 1978 and on the security duties in articles 5 and 32 GDPR, and it notes that logs can also help document who received data, which links to the right of access in article 15.
The text sets the tension it tries to settle. Logs protect the system and let an organisation watch what authorised users do. Kept too long or filled with too much data, they become a risk of their own.
The recommendation covers logging devices that trace the access and actions of authorised users in the application that carries the processing. It does not cover perimeter logs, which follow a different logic. It applies to public and private bodies, but not to processing whose main purpose is logging itself.
For a PHP application this draws a useful line. Web server access logs, firewall logs and PHP’s own error output sit on one side. The record of who read, changed or deleted a customer, an order or a medical note sits on the other, and that second record is what the recommendation addresses.
For the general case the recommendation names the creation, consultation, modification and deletion of the data and information of the processing. An entry carries four things: the author, identified individually, a timestamp, the nature of the operation and a reference to the data concerned. It asks to avoid duplicating the data of the processing in the log, and to keep personal data in logs to a minimum.
That last point decides the shape of the code. A line that says user 4821 viewed customer record 77 at a given time answers the question. A line that copies the customer’s name, address and order total into the log creates a second copy of the data, with its own retention and its own access rules.
<?php
function audit(int $userId, string $operation, string $entity, int $entityId): void
{
$line = json_encode([
'at' => (new DateTimeImmutable('now', new DateTimeZone('UTC')))->format(DATE_ATOM),
'user' => $userId,
'op' => $operation, // create, read, update, delete
'entity' => $entity,
'id' => $entityId,
], JSON_THROW_ON_ERROR) . "\n";
error_log($line, 3, '/var/log/app/audit.log');
}The sample logs identifiers only. The reference lets a person with the right access look up the record, and the log itself stays small.
The error_log() function in the PHP manual takes a message and a message type. Type 0, the default, sends the message to the system logger, and where it ends up depends on the error_log ini directive. Type 3 appends the message to the file named in the destination. The manual says no newline is added for type 3, so the caller adds it, as in the sample above. It also says the function is not binary safe: the message is cut at a null character, so encode messages that might contain one. The manual recommends absolute file paths.
Two settings matter for the other log, the one PHP writes for errors. The manual lists display_errors with a default of On, and says it should never be used on production systems. log_errors defaults to Off. The manual’s example for production sets display_errors = Off, log_errors = On, an error_log path and html_errors = Off, and states that error logging should be used in place of error displaying on production sites.
The privacy link is direct. A displayed error can show a query, a path or a parameter to the visitor. A logged error can hold the same text in a file that lives for years, with no retention rule. The CNIL recommendation does not cover PHP error output, but its logic applies by analogy: keep the personal data in error messages to a minimum and give the file a defined life.
For the general case the recommendation gives six months to one year. The text allows more in defined situations:
The period is a decision. I do not pick it. I build the rotation once the controller has written it down, for example a daily file name and a job that deletes files older than the set period. Rotation also has to cover copies: a log deleted from the server and kept for years in a backup has not been deleted.
The recommendation goes beyond the log line. It asks for:
Some of this is infrastructure, such as write-only storage. Some is code. A signature per entry can be built from hash_hmac() in PHP, which takes an algorithm such as sha256, the data and a secret key, and returns a hex string. Chaining each entry to the signature of the previous one makes deleted or altered lines visible. That construction is my illustration of what signing could look like, not a method the CNIL prescribes, and the key must live where the application’s own account cannot rewrite it.
<?php
function signed_line(string $json, string $previousSignature, string $key): string
{
$signature = hash_hmac('sha256', $previousSignature . $json, $key);
return $json . ' ' . $signature . "\n";
}An alert on abnormal behaviour can start small: a scheduled script that counts consultations per user per hour and writes to the person responsible when one account reads far more records than its role suggests. The threshold belongs to the controller’s risk analysis.
Where a subcontractor carries out the processing in whole or in part, the recommendation asks that the subcontract include a logging duty consistent with it. For a Lyon company that hires a PHP developer or an agency, that is a clause to check in the contract. It also means the developer should be able to say what the application logs and for how long. The recommendation adds that people exercise their rights regarding logs against the controller of the main processing, and that the entry in the register of processing activities can sit inside the entry of the processing concerned.
The general offer is described on the PHP developer page.
Lyon teams with a PHP application that handles personal data can use the contact form to say what the application records today, where the files go and who can open them. The first written estimate is free and lists the audit calls and rotation jobs I would add. Which retention period applies is for you and your adviser to settle.
Examples of my work.
Since March 25, 2013, the GIDpl.ru portal has continuously informed users about the most important cultural and sports events as well as tourist and commerci...
The haveabook.pl website is a modern platform dedicated to publishing and printing, catering to demanding clients from Scandinavian countries. The project wa...
Ilovehair.pl is an e-commerce store based on the WordPress platform, dedicated to the sale of professional hairdressing products by Hair Saloon Products. As ...
Describe your project by e-mail. I reply within 24 hours.
Describe your projectNeed to show the category hierarchy in your theme? Learn how to get the current category and its parent using get_the_category() and get_category_parents().
Need to get the URL of the first image or link in an article? Prefer DOMDocument over regex. Ready-made WordPress PHP for developers.
On 1 December 2026 Taylor Otwell shipped the Laravel Rust beta, and Laravel Go followed a day later. What the framework contains, what the 18x benchmark really measures, what happens to Laravel PHP and WordPress, and when a rewrite makes sense.
Custom WordPress engineering and architecture.
Scalable headless, ERP, and AI architecture for enterprise.
Stores, checkout flow, and sales logic.
Stability, updates, and post-launch support.
What the monthly care fee covers and what changes it.
Business process automation around WordPress and company systems.
Headless WordPress, Sanity, Strapi, and Contentful with Astro or Next.js.
Astro, MDX, edge delivery, and Core Web Vitals measured on real traffic.

How to start as a WordPress developer in 2026. Local environment, theme and plugin development, REST API and headless paths, security and Core Web Vitals. A practitioner playbook that does not waste your first month.

WordPress 7.0 with AI Client against Astro 7 with the Rust compiler and Vite 8. Speed, cost, SEO and security compared, plus the real bill for my own Astro 6 to 7 migration.

A detailed comparison table of EmDash CMS and WordPress across architecture, security, plugins, AI features, content model, hosting, and ecosystem maturity.