|
/ Documentation /Custom Code Snippets/ How to Customize Community Content Post Slugs in SureDash

How to Customize Community Content Post Slugs in SureDash

Introduction

In SureDash v1.5.0, we’ve added the flexibility to customize the URL slugs used for community content posts. This means you can now modify how the lesson, resource, and event URLs appear on your site. For example, instead of having a URL like yoursite.com/lesson/my-topic. You can change it to something shorter or more meaningful, such as yoursite.com/ls/my-topic.

This can be helpful for branding purposes, improving readability, or keeping URLs concise.

How It Works

SureDash now provides filters that allow you to modify the default slugs for each type of community content post. You can use these filters directly in your theme’s functions.php file or within a custom plugin.

The available filters are:

  • suredash_community_content_post_lesson_slug – for Lesson post type slug.
  • suredash_community_content_post_resource_slug – for Resource post type slug.
  • suredash_community_content_post_event_slug – for Event post type slug.

Example Usage

Below is an example of how you can modify each of the content post slugs:

add_filter( 'suredash_community_content_post_lesson_slug', function ( $slug ) {
    return 'ls'; // For "lesson" slug.
} );

add_filter( 'suredash_community_content_post_resource_slug', function ( $slug ) {
    return 'rs'; // For "resource" slug.
} );

add_filter( 'suredash_community_content_post_event_slug', function ( $slug ) {
    return 'ev'; // For "event" slug.
} );

After adding the code above, the URLs will look like this:

  • Lesson: yoursite.com/ls/sample-lesson
  • Resource: yoursite.com/rs/sample-resource
  • Event: yoursite.com/ev/sample-event

Important Note

After updating the slugs, it’s important to flush the permalinks to make sure the new URLs work correctly.
To do this:

  1. Go to your WordPress Dashboard.
  2. Navigate to Settings > Permalinks.
  3. Simply click Save Changes (no need to modify anything).

This refreshes WordPress’s URL structure and ensures the changes take effect.

Conclusion

Customizing community content post slugs gives you more control over how your URLs appear and can help improve both usability and branding. With the new filters added in SureDash v1.5.0, adjusting these slugs is quick and simple. Just add the filters to your theme or custom plugin, flush your permalinks, and your new URLs will be ready to go.

If you need any help while setting this up or have questions, feel free to reach out to our support team. We’re always happy to assist you.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page
Scroll to Top