Back to Main Site

Hook: category.frontend_url

Last updated on Jun 24, 2026 01:42

Overview

Type: Filter Location: app/Models/Category.php

Filters the public URL of a category. Called when $category->frontend_url is accessed. Themes can use this to create custom URL structures for category archives.

Parameters

Param Type Description
$url string Default category URL
$category Category Category model instance

Return

Must return string - the final URL.

Usage Example

Use parent slug in category URL for documentation themes:

Hook::addFilter('category.frontend_url', function (string $url, $category) {
    if ($category->parent && $category->parent->slug === 'documentation') {
        return '/docs/' . $category->slug;
    }
    return $url;
});

Related Hooks

post.frontend_url - Customize post public URL

theme.view.data - Inject data into views


PolyCMS is an open-source content management system for modern web applications, inspired by the WordPress plugin and theme ecosystem but built on top of the Laravel framework. It is designed to provide a complete foundation for content publishing, e-commerce, multi-language support, and extensible module architecture — powered by a Vue 3 admin panel with data served entirely through RESTful APIs.

Whether you're building a blog, a documentation site, an online store, or a multi-tenant SaaS platform, PolyCMS aims to give you a comprehensive starting scaffold so you can ship quickly and extend easily through integrated modules and themes. In particular, themes in PolyCMS follow a multi-theme architecture — one Main theme and an unlimited number of Sub themes can run side by side on the same installation.

We hope this ready-made foundation proves useful for building your next website, blog, or web app, saving you from having to start completely from scratch.