Dynamic Permalinks with Advanced Custom Fields (ACF)

Advanced Custom Fields is one of the most popular plugins for managing custom post types and fields. When combined with Permalink Manager, this offers up a world of options for customizing the content URLs.

Unfortunately, ACF does not offer many possibilities for altering URLs. This can be a problem if you want to remove the rewrite base or use it across multiple content types. In that instance, using a plugin such as Permalink Manager is the simplest solution.

The goal of the following article is to provide you an overview of the Permalink Manager features that you may use for CPT and taxonomies registered with ACF.

What is the Advanced Custom Fields plugin?

ACF, or Advanced Custom Fields, is a useful tool that is currently ranked among the top 50 plugins in the WordPress.org repository. Its goal is to make it easier to manage custom fields and post types and taxonomies.

ACF admin interface
The user-friendly interface makes it easy to declare new content types and metadata without having to write any PHP code.

 

There is both a free version that has all of the basic functionality required for most websites and a premium version. ACF Pro offers additional features like the repeater field and the ability to create custom theme option pages.

Custom content types and taxonomies that are registered with ACF contain the rewrite slugs in their permalinks. This is necessary because WordPress's built-in permalink system uses different URL structures to determine which content type should be loaded.

The rewrite slug is by default the post type or taxonomy name. The URL for a single item of the "job" custom post type and "city" category can look like this:

Original URLs

While removing that slug and reusing it for other content types is not supported by WordPress core or ACF, it can be done with the help of a plugin like Permalink Manager.

The instructions in this article apply not only to ACF-registered content types, but also to other post types and taxonomies.

Removing Custom Post Type & Taxonomy Slug From URLs

The "rewrite slugs" lengthen the permalinks and make them more challenging to understand. If you want to get rid of them, the plugin offers a hassle-free solution to shorten them.

Remove rewrite slug

The Permalink Manager comes with Permastructures that allow to remove the post type and taxonomy slugs from content items. With just a few clicks, you can remove unnecessary slugs and create more concise permalinks for your content.

How to Duplicate a Rewrite Slug?

Permalink Manager allows you to do more than just remove rewrite slugs from ACF permalinks. It can also be very useful if you want to implement silo architecture into your URL structure.

Practically speaking, this means you may use the same permalink structure to different types of content.

Duplicate rewrite slug

It is not possible with ACF alone, but Permalink Manager supports it because it uses complete custom permalinks instead of built-in rewrite rules to identify content. As long as each permalink stays unique, the plugin will have no trouble detecting them.

This functionality is very beneficial for websites that use hierarchical content structures. By duplicating a rewriting slug in Permalink Manager, you can simply organize your content and improve the user experience by forming a logical hierarchy.

Another handy feature of Permalink Manager is the ability to add a custom taxonomy slug to a single custom post type URL. This feature allows you to customize the permalink of custom post types by including a slug of a single term assigned to them.

Adding a custom taxonomy to an Advanced Custom Fields (ACF) permalink is a straightforward process with Permalink Manager. Adding a single term slug to the CPT items can enhance the user experience of your website by displaying the hierarchical structure of the content in the URLs.

 

Add category to custom permalinks

Permalink Manager supports both hierarchical and flat taxonomies. Furthermore, you can set the plugin to automatically remove parent category slugs.

One thing that makes Permalink Manager stand out is the possibility to directly add custom fields into the permalinks. This process is straightforward and fairly similar to adding taxonomy to individual permalinks.

As shown below, the plugin allows you to directly copy the text values entered into ACF metabox fields and add them to the custom permalink.

A sample WordPress permalink with custom field values.
The new permalink contains the custom fields values set-up with Advanced Custom Fields.
Avatar for Maciej BisAbout Maciej Bis

Maciej has over 10 years of WordPress expertise and is the author of Permalink Manager, a popular WordPress plugin for managing permalinks. He has extensive experience in WordPress programming and has worked with clients from all around the world.

Leave a Reply

Your email address will not be published. Required fields are marked *