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().

Photo: Eusebius, CC BY 3.0, Wikimedia Commons.
A custom PHP application in Nantes gets its security posture from many places. One of them is a French public document: the ANSSI guide on website security standards. This page is by Mariusz Szatkowski, who builds PHP applications from Gdynia, remotely and by email. It reads the guide as a checklist for PHP code and settings, and says where the guide stops.
The guide is ANSSI-PA-009, published on the ANSSI site MesServicesCyber. Its full title is “Recommandations pour la mise en oeuvre d’un site web : maitriser les standards de securite cote navigateur”. The version history in the PDF lists version 1.0 of 22 April 2013, version 1.1 of 13 August 2013 and version 2.0 of 28 April 2021, described as a rewrite from the angle of web security standards.
Older material on the web still uses the 2013 title “Recommandations pour la securisation des sites web”. The current guide is the 2021 rewrite. The cyber.gouv.fr publication page did not answer automated requests when I checked, so every statement below comes from the PDF on messervices.cyber.gouv.fr.
Two things in the guide’s own notice matter for a client conversation:
So this is a reference, not a statute. Whether your organisation treats it as binding is an internal decision, or one for your information security officer.
The cookie section of the guide is the part that PHP developers meet first. These are the recommendations, in the guide’s numbering:
| Recommendation | What the guide asks | Where it lands in PHP |
|---|---|---|
| R26 | Except for session tokens, keep sensitive information out of cookies | Application design: store the data server-side |
| R28 | Set the cookie path by least privilege | The path key of the session cookie parameters |
| R29 and R30 | Use HttpOnly where script access is not needed, and always on a session cookie | session.cookie_httponly |
| R31 | Use Secure when the site is HTTPS only | session.cookie_secure |
| R32 | Set SameSite to Strict when the cookie is not needed on cross-site navigation, otherwise Lax | session.cookie_samesite |
| R33 | A session cookie must define SameSite and must not use None | session.cookie_samesite |
The guide also advises splitting areas of different responsibility onto separate domains (R27), and notes that not setting the Domain attribute is generally good practice, because the browser then limits the cookie to the issuing host.
The php.net manual lists the defaults that matter here. session.cookie_secure is Off by default. For session.cookie_httponly, session.cookie_samesite and session.use_strict_mode the manual states changed defaults from PHP 8.6.0 (On, “Lax” and On), and says that before that version the first and third were Off and the second was empty. A project that runs an older PHP version, or that cannot rely on a version-dependent default, sets all of them explicitly:
session.cookie_secure = 1
session.cookie_httponly = 1
session.cookie_samesite = "Lax"
session.use_strict_mode = 1
session.use_only_cookies = 1The same can be done in code before session_start(), with the options array that session_set_cookie_params() accepts:
session_set_cookie_params([
'lifetime' => 0,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
session_start();On session.use_strict_mode and session.use_only_cookies the guide says nothing. They come from php.net: strict mode makes PHP refuse session IDs it did not issue, which the manual says protects against session fixation via session adoption, and use_only_cookies keeps session IDs out of URLs. After a login, session_regenerate_id() replaces the ID, and its manual page shows how to keep the old session from being lost during the swap.
The guide spends most of its length on headers a browser enforces. In PHP they are header() calls, or the same lines in the proxy or web server in front of PHP. The relevant recommendations:
Strict-Transport-Security: max-age=31536000; includeSubDomains. It warns that HSTS makes plain HTTP access impossible, so permanent HTTPS must be in place first.*.A minimal sketch in PHP:
header('Strict-Transport-Security: max-age=31536000; includeSubDomains');
header("Content-Security-Policy: default-src 'self'; frame-ancestors 'none'");
header('X-Frame-Options: DENY');
header('Referrer-Policy: strict-origin');
header('Content-Type: text/html; charset=utf-8');The values are examples from the guide’s vocabulary, not a drop-in policy. A real CSP depends on every script, style and font the pages load. The guide also recommends studying the sensitivity of pages before switching on CSP violation reports (R19). For the three places where a CSP header can be set, the guide names the reverse proxy configuration, a request to the hosting provider, and the security settings of the CMS or framework in use. A header() call counts as the framework level. If a proxy already sets the same header, one of the two should own it, so the response does not carry conflicting copies.
The practical effect of R15 is on templates. Inline script blocks and inline event handlers stop working under a policy without ‘unsafe-inline’, so PHP views that rely on them need their JavaScript moved to files. That is my reading of the recommendation, and it is where most of the work sits in an older code base.
R38 asks for an anti-CSRF token on XHR calls. The token must hold a random value from a cryptographic generator with at least 128 bits of entropy. The guide gives 22 random characters from the 62 characters A to Z, a to z and 0 to 9 as one way to reach that. It lists two ways to hand the token to the client: a dedicated response header, or an HTML meta tag.
The php.net manual describes random_bytes() as returning cryptographically secure random bytes, so 16 bytes meet the 128 bit floor:
$_SESSION['csrf'] ??= bin2hex(random_bytes(16));The check on the server compares the received value with the session value, and hash_equals() from php.net does that comparison in constant time.
Version 2.0 is about browser-side standards. It does not discuss PHP error messages or the PHP version banner, so there is no ANSSI recommendation to cite for them. Both are covered by php.net:
display_errors = Off
log_errors = 1
expose_php = OffHiding the banner is housekeeping, not protection, and the guide does not claim otherwise.
Everything is remote. The wider PHP offer sits on the PHP developer page. If the site runs on WordPress, there is a maintenance plan for updates. If you want the guide checked against your application, send the scope through the contact page. You get the first written estimate without charge.
Examples of my work.
The lifetree.pl website is a platform dedicated to personal development, healthy lifestyle, and inspiration from nature. The project was created for users se...
Linkr.pl is an online portal launched in 2007 as an alternative to Wykop.pl, which at that time dominated the Polish “social news” market. The project was in...
Osiedlegalaktyka.pl is a professional project in my WordPress developer portfolio, realised as a website promoting a modern residential estate in Szczecin, l...
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.