Support » Plugin: Custom Post Type Archives » Remove trailing slash

Viewing 5 replies - 1 through 5 (of 5 total)
  • I would like to know this as well.

    You can use this untrailingslashit($url). It will remove any trailing slashes.

    Thanks for your reply @codepress.

    Any hints on how to use that function globally? I’m not sure how to use it.

    You can remove the trailing slash globally by going to “Settings > Permalinks”, and set your own custom structure without the trailingslash.

    For the generated links inside your theme you could try the following – this will remove trailingslashes for links that have been generated by the the_permalink() function for posts and pages.

    function permalink_untrailingslashit($link) {
    	return untrailingslashit($link);
    }
    add_filter('page_link', 'permalink_untrailingslashit');
    add_filter('post_type_link', 'permalink_untrailingslashit');

    You are right codepress, thanks.

    In my case, configuring the permalinks accordingly and disabling Custom permalinks allowed me to accomplish this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove trailing slash’ is closed to new replies.