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().
A PHP application that sets a cookie, writes to local storage or reads device signals in the UK works under a rewritten regulation 6 of PECR. I am Mariusz Szatkowski, a developer in Gdynia, working with WordPress since 2006 and building Laravel and Symfony applications, all of it remotely and in writing. This page reads the new text from legislation.gov.uk, states what is in force, and maps each exception to code. I am not a lawyer: which exception your purpose fits is your call, made with your adviser.

Manchester Town Hall, Lloyd Street side. Photograph by Mark Andrew, released under CC BY 2.0, file on Wikimedia Commons.
Section 112 of the Data (Use and Access) Act 2025 substitutes regulation 6 of the Privacy and Electronic Communications (EC Directive) Regulations 2003. The new regulation 6(1) is a single prohibition: a person must not store information, or gain access to information stored, in the terminal equipment of a subscriber or user, subject to Schedule A1.
Regulation 6(2) widens what counts. Storing or accessing includes instigating the storage or access, so a PHP page that ships a third-party script which then sets a cookie is still in scope. Unless a provision says otherwise, gaining access also includes collecting or monitoring information automatically emitted by the device. On my reading, that puts techniques built on such emitted information, often called device fingerprinting, under the same rule as cookies.
The exceptions moved into a new Schedule A1, inserted by Schedule 12 of the Act. Schedule A1 defines “website” to include a mobile application and any other platform through which an information society service is provided.
Section 112 also inserts regulation 6A. It allows the Secretary of State to add an exception, or to omit or vary one, by statutory instrument. The draft must be approved by both Houses of Parliament, and the regulator has to be consulted first. The list in Schedule A1 is therefore designed to change, and code that hardcodes a legal category should be easy to revisit.
Yes. The annotations on legislation.gov.uk show that section 112 was in force at Royal Assent only for specified purposes, and in full from 5 February 2026. Schedule 12 was not in force at Royal Assent and came into force on 5 February 2026. Both dates come from S.I. 2026/82, the Data (Use and Access) Act 2025 (Commencement No. 6 and Transitional and Saving Provisions) Regulations 2026.
The revised text of Schedule A1 in PECR, which I read on 4 December 2026, carries only the insertion note for 5 February 2026. I found no instrument under regulation 6A amending the exceptions since then.
Section 115 and Schedule 13, which replace the regulator’s PECR enforcement powers, also came into force on 5 February 2026 under the same instrument.
Schedule A1 has six routes out of the prohibition. Paraphrased from the Act:
| Paragraph | Exception | Conditions in the text |
|---|---|---|
| 2 | Consent | clear and comprehensive information about the purpose, and consent |
| 3 | Transmission | technical storage or access for the sole purpose of carrying a communication over a network |
| 4 | Strictly necessary | technical storage or access strictly necessary for an information society service the user requested |
| 5 | Statistics | sole purpose is statistics on use with a view to improving the service or website; limited sharing; information; simple free objection; no objection |
| 6 | Appearance and functionality | sole purpose is adapting the website to preferences or enhancing appearance or functionality; information; simple free objection; no objection |
| 7 | Emergency assistance | locating a user who asks for or needs emergency assistance |
For consent, paragraph 2(3) says users may signify it by amending or setting browser controls, or by using another application or programme. Paragraph 2(2), and similar rules in paragraphs 5 and 6, say that when the same person stores or accesses information for the same purpose more than once, the conditions need only be met for the initial use.
Paragraph 4(2) lists examples of strictly necessary storage: protecting information provided for the requested service, keeping the user’s device secure, preventing or detecting fraud, preventing or detecting technical faults, automatically authenticating the user, and keeping a record of selections made on a website or information entered into it.
Paragraph 5 is the change most PHP site owners ask about. Storage or access is allowed without consent if all of these hold:
Paragraph 5(2) adds a limit. For this exception, gaining access does not include collecting or monitoring information that the device emits automatically. A statistics script that relies on device signals rather than stored information falls outside paragraph 5.
The wording “sole purpose” does real work. A tag that also feeds advertising, audience building or a data broker is not used solely for statistics, and the sharing condition in paragraph 5(1)(c) points the same way. Whether a particular analytics product meets these conditions depends on its configuration and contract, and that assessment belongs to you and your adviser.
Paragraph 6 covers storage whose sole purpose is to let the website adapt to the user’s preferences, or to enhance its appearance or functionality on the user’s device. Typical candidates are a saved theme, a chosen text size or a remembered layout. The conditions match paragraph 5 on information and objection: clear information about the purpose, a simple free means of objecting, and no objection from the user.
Paragraph 6 applies only where the service is provided by means of a website, which under paragraph 1 includes a mobile application.
The exceptions shift the rule from “ask first” to “inform, allow objection, and keep to the purpose” for two categories. That still leaves work for the application.
Each cookie, local storage key and session value the application writes should have a named purpose and the Schedule A1 paragraph it relies on. Regulation 6A means the list of exceptions can change, so the register belongs in code or configuration rather than in someone’s memory.
<?php
declare(strict_types=1);
// Each entry: purpose and the Schedule A1 paragraph relied on.
return [
'app_session' => ['purpose' => 'authenticate signed-in user', 'basis' => 'para4'],
'basket' => ['purpose' => 'remember basket selections', 'basis' => 'para4'],
'ui_theme' => ['purpose' => 'remember chosen colour theme', 'basis' => 'para6'],
'stats_id' => ['purpose' => 'count visits to improve the site', 'basis' => 'para5'],
'ad_click' => ['purpose' => 'attribute advertising', 'basis' => 'para2'],
];For paragraph 5 and 6 items the condition is that the user “does not object”. The application therefore needs a stored objection state per purpose, checked on the server before the cookie is set and before the statistics or preference script is printed into the page. An objection control that only hides a banner, while the PHP template still emits the tag, meets none of the conditions.
PHP creates or resumes a session when session_start() is called, according to php.net. A session cookie for a signed-in user or a basket fits the paragraph 4 examples. Starting a session on every anonymous page view, without a stored item that needs it, makes it harder to argue that each stored item is strictly necessary.
The session configuration page on php.net documents the relevant settings:
session.use_strict_mode stops PHP accepting uninitialised session IDs, which protects against session fixation. The manual calls enabling it mandatory for general session security. It defaults to On as of PHP 8.6.0 and was Off before.session.cookie_httponly keeps the session cookie away from JavaScript. It defaults to On as of PHP 8.6.0 and was Off before.session.cookie_samesite defaults to Lax as of PHP 8.6.0. Earlier versions set no SameSite attribute by default.session.cookie_secure limits the cookie to HTTPS. It still defaults to off.An application running PHP 8.5 or older gets none of the newer defaults unless its configuration sets them. These settings also support the paragraph 4(2) examples on protecting information and keeping the user’s device secure.
Since PHP 7.3, setcookie() accepts an options array with expires, path, domain, secure, httponly and samesite, and PHP 8.5 added partitioned. The manual notes that a SameSite value of None requires secure.
<?php
declare(strict_types=1);
if (!$objections->has('preferences')) {
setcookie('ui_theme', $theme, [
'expires' => time() + 60 * 60 * 24 * 180,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
}Paragraph 5(1)(c) limits sharing to those helping with improvements. On the server side that means the statistics tables or log exports are not joined into a marketing database and not sent to a vendor for its own purposes.
The regulator changed name and form during 2026. Sections 118 and 119 of the Act abolish the office of the Information Commissioner and transfer its functions to the Information Commission. Both came into force on 30 September 2026 under S.I. 2026/1015, and section 119 says references to the Commissioner in legislation are treated as references to the Commission. Regulation 6A of PECR now names the Information Commission among those to be consulted before new exceptions are made.
The broader PHP offer, from Laravel and Symfony builds to version upgrades, is on the PHP developer page.
If your Manchester PHP application sets cookies or loads analytics, use the contact form to send its address, the PHP version and the list of tools it loads. Preparing the first written estimate for the storage register and code changes is free of charge. Which Schedule A1 paragraph each purpose falls under is for you and your adviser to settle.
Examples of my work.
Osiedlegalaktyka.pl is a professional project in my WordPress developer portfolio, realised as a website promoting a modern residential estate in Szczecin, l...
predko.pl is a modern website dedicated to the life and career of rally driver Krzysztof Predko. The site was designed with fans of motorsports and anyone in...
Rezydencja Park Mielno is a complex of boutique apartments by the sea, created with the idea of harmony with the surrounding nature and providing a family at...
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.