We recently published a WordPress website with a blog and podcast imported from Square. We used the plugin Seriously Simple Podcasting, which works really well. Once imported, all the podcast episodes worked pretty easily with Seriously Simple Podcasting.
Since the site had a history with Google, we wanted to match the existing link structure. This is very important for Search Engine Optimization.
Here were the criteria for blog and podcast links (also called URLs, uniform resource locators).
- the main blog URL must be “~/blog/”
- individual blog post URLs must include “blog” and the date in this format:
“~/blog/12/31/2023/blog-slug-goes-here” - the main podcast URL must be “~/podcast/”
- individual podcast URLs must include “podcast” and the date in this format:
“~/podcast/12/31/2023/podcast-slug-goes-here”
This configuration is not available with existing settings. We solved this as two different issues:
- Prefixing URLs with the correct prefix: “blog” or “podcast”
- Including the date in the URLs
I thought others might use this info, so here’s how we did it.
Blog Permalinks – Easy with Standard WordPress Settings
Adding “blog” and the date to blog URLs is simple and easy. Under Settings > Permalinks:
- Select Custom Structure
- Enter this snippet in the Custom Structure field:
/blog/%year%/%monthnum%/%day%/%postname%/ - Click Save Changes.
This Caused a Problem With Podcast URLs
Permalink Custom Structure worked fine for blog posts, but the podcast URLs had several problems:
- The permalink settings added “blog” to the beginning of podcast URLs, so podcast URLs looked like this:
“~/blog/podcast/podcast-slug-goes-here” - Seriously Simple Podcasting does not use the permalink structure, so the date did not show in podcast URLs. After we removed “blog”, they looked like this :
“~/podcast/podcast-slug-goes-here”
Podcast Permalinks
Podcast URLs needed two solutions. We had to remove “blog” from podcast URLs, and we needed to insert the date in the URL
Removing “blog” Prefix From Podcast URLs
This is done by adding this code with a snippet plugin, the theme’s function file, or a custom plugin.
/** * Set 'with_front' to false for the 'podcast' post type. */
add_filter( 'register_post_type_args', function( $args, $post_type )
{
if( 'podcast' === $post_type && is_array( $args ) )
$args['rewrite']['with_front'] = false;
return $args;
}, 99, 2 );
This code removes the “front” from podcast URLs. It removes the prefix that’s in the permalink Custom Structure setting.
Podcast Page Redirect Fixed
We also had a problem with the main podcast page redirecting to the podcast RSS feed. This seemed to fix the redirect, but we didn’t test it enough to confirm that this was the fix.
Another Option from Seriously Simple Podcasting
Here’s another option. It comes from Serhiy Zakharchenko, one of the plugin authors. He says, “By the way, maybe it’s better to use SSP filter for it, like this:”
add_action( 'ssp_register_post_type_args', function ( $args ) {
$args['rewrite']['with_front'] = false;
return $args;
} );
This comes from a conversation we had on the WordPress.org support forum. Pacesetter Media hasn’t tested this approach because the first option was in place and working.
Find his original comment at WordPress.org.
Adding Date to Podcast URLs
To add the date to podcast episode URLs, we used the plugin Custom Post Type Permalinks. This adds a section for custom post types to Settings > Permalinks. This plugin is simple to use, and it just worked.
Adding the date to podcast URLs became simple and easy. Under Settings > Permalinks:
- Scroll down to the section Permalink Settings for Custom Post Types.
- Enter this snippet in the Podcast field:
/%year%/%monthnum%/%day%/%postname%/ - Click Save Changes.
Since Seriously Simple Podcasting already prefixes episode URLs with “podcast”, we didn’t need to include this prefix.
Conclusion
I hope this helps somebody. It’s pretty simple once you know how.