Display Frontend Category URL in Backend Magento

Display Frontend Category URL in Backend Magento

October 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Display Frontend Category URL in Backend Magento

Displaying Frontend Category URL in Magento Backend

As a senior developer at Laravel Company, I often help clients customize their eCommerce platforms to meet specific business needs. One common request is to display the frontend category URL within the backend interface of Magento.

In Magento 2, the default behavior shows the category’s internal ID or URL key in the admin panel. However, you might want to display the full SEO-friendly URL that appears on your storefront. Let me guide you through this process step-by-step.

Understanding the Category URL Structure

Before diving into the code, let’s clarify Magento’s category URL structure:

  • Internal URL Key: This is a short, alphanumeric identifier for your category (e.g., electronics). You set it manually under each category.
  • Frontend URL: This is the human-readable URL that appears in the browser bar (e.g., www.example.com/electronics). It’s generated based on the internal URL key and includes the store view’s base URL.

Retrieving the Frontend Category URL

To access the frontend category URL from the backend, you need to create a custom attribute and use it in your admin grid. Here’s how:

  1. Create a Custom Category Attribute

First, let’s create an attribute that will hold the frontend URL value. In Magento 2, you can do this via the command line or the database.

Using the command line (recommended):

php bin/magento setup:install --use-default-config-xml=true

After running this command, check your MySQL database for the new attribute entry in the catalog_eav_attribute table. You’ll need the attribute_id for the next step.

  1. Add the Attribute to Your Grid

Next, you want to display this new attribute in your category grid in the admin panel. For this, open your theme’s layout file (usually located at app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_category_index.xml).

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="catalog_category_blog_index_index"/>
    <referenceBlock name="category.grid">
        <arguments>
            <argument name="dataSource" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult</argument>
        </arguments>
    </referenceBlock>
</page>

Insert your custom attribute’s ID where the catalog_category_index_index handle is defined. If you haven’t created a grid for categories yet, you’ll need to define a new one.

Populating the Custom Attribute

Now, let’s write code to populate this custom frontend URL attribute with actual data. You can do this in a plugin or an observer, but using a plugin is more efficient:

<?php
namespace Vendor\Module\Plugin;

class FrontendUrlPlugin
{
    public function afterGetAttributeText(\Magento\Catalog\Model\Category $subject, $result)
    {
        if ($subject->getData('attribute_id') == <YOUR_ATTRIBUTE_ID>) {
            $url = $subject->getStore()->getBaseUrl() . $subject->getUrlPath();
            return $url;
        }
        return $result;
    }
}

Replace <YOUR_ATTRIBUTE_ID> with the ID of your custom attribute.

Conclusion

Displaying frontend category URLs in the Magento backend requires a combination of creating a custom attribute, updating grid layout files, and writing code to populate this attribute. Remember to enable your module and flush cache after making these changes.

This approach ensures that you see the same URL structure in both the frontend and the backend, simplifying navigation and management for your admin users.

For more advanced Magento 2 customizations and development services, feel free to reach out to our team at Laravel Company. We specialize in helping businesses optimize their eCommerce platforms for better performance and user experience.

Happy coding!

Magento 2 Catalog Database Admin

Our network