Rewrite Options For Pods Custom Post Types and Taxonomies

Pods provides several URL rewrite options that allow you to customize the URLs for items in your custom post types and custom taxonomies in order to fit your needs. In this tutorial, I will go over the various options and what changes they result in.

All of these options are available in the “Advanced Options” tab of the Pods editor.

Custom Post Types

Rewrite options in Pods editor for custom post type.
Rewrite options in Pods editor for custom post type.

If you disable the “Rewrite” option, no matter what your WordPress permalink settings are, the permalink structure for your custom post type will be in the form of “example.com/?pod_name=post_slug/”. So, for example, if you had a Pod called “foo”, with a post, that had the slug “bar” the url would be “example.com/?foo=bar/”.  This configuration may be useful to you if you want to make use of the PHP get method. When pretty permalinks are enabled, as is usually the case, you will want to keep the option “Rewrite” enabled, in order to mimic the permalink structure of posts and pages.

A typical “pretty permalinks” setup for WordPress posts will take the form of “http://example.com/blog/post_slug/”. With “Rewrite” enabled, and “rewrite with front” enabled, your custom post type’s url will be in the form of “http://example.com/blog/pod_name/post_slug/”. So, for example, if you had a Pod called “foo”, with a post, that had the slug “bar” the url would be “http://example.com/blog/foo/bar”. Alternatively, if you disable “rewrite with front” you will get “http://example.com/foo/bar/” which is probably what you wanted.

You do not have to have the Pod name as the first segment of the URL. You can customize what that segment is using the “Custom Rewrite Slug” field. If you were to enter “fighter” in that field, your URL would become “http://example.com/fighter/bar/”.

There are also options for “Rewrite With Page Numbers,” which adds page numbers for paged posts and “Rewrite Feeds,” which enables the rewrite options in your RSS feeds. Note: “Rewrite With Page Numbers” was known as “Rewrite Feeds” prior to Pods 3.0.

Taxonomies

tax-rewrite-options
Rewrite options in Pods editor for custom taxonomy.

Custom taxonomies have three rewrite options that function the same way as they do for custom post types. These options are “Rewrite,” “Custom Rewrite Slug” and “Allow Front Prepend.” Custom taxonomies have one option that custom post types do not have called “Hierarchical Permalinks.”

“Hierarchical Permalinks” match the structure of a hierarchical taxonomy. If you have a term in your taxonomy called “foo” with the child term “bar” and select this option the url for the term bar, will be “http://example.com/foo/bar/”. If not selected the url for bar will be “http://example.com/bar/”. This option has no effect on non-hierarchical  taxonomies.

 

6 thoughts on “Rewrite Options For Pods Custom Post Types and Taxonomies”

  1. Hi Josh,

    I’ve created a custom post type, Courses. And a custom taxonomy, Subjects. Both using Pods rather than in functions.php. I’ve played around with the rewrite options you explain in this article, but I can’t get WordPress to show pretty permalinks.
    Visiting domain.com/courses/ and domain.com/subjects/ both give a 404.

    In the admin area if I go to Courses (Screenshot: http://rikdeakin.com/Courses.png) and Subjects (Screenshot: http://rikdeakin.com/Subjects.png) and click on the “view” link for an item, I get standard urls: http://localhost/pods/?courses=alexander-technique

    I’ve tried setting the permalinks in settings > permalinks to /%category%/%postname%/ But this gives me a 404.

    No matter what I try, I can’t get pretty permalinks to work for my CPT and CT.

    Am I missing something obvious?

    Thank you,
    – Rik

  2. I’m running WordPress 4.1 and Pods 2.5 and can’t get the “Rewrite with Front” or any of the other checkbox values (Public, Publicly Queryable, Rewrite Pages) to stick. These values all revert upon saving the pod. Any ideas?

    • This is a known issue in 2.5 that has been fixed in 2.5.1-beta. For information on how to get the latest version of Pods, see: pods.io/tutorials/getting-latest-version-pods/

  3. Hi Josh. In the last paragraph, I think there’s a typo. Shouldn’t…
    If you have a term in your taxonomy called “foo” with the child term “foo” and select this option the url for the term bar, will be “http://example.com/foo/bar/”.
    be…
    If you have a term in your taxonomy called “foo” with the child term “bar” and select this option the url for the term bar, will be “http://example.com/foo/bar/”.
    ?

    Great tutorials… thanks for all the info. I love PODS!

Comments are closed.