Support » Plugin: Sugar Calendar (Lite) » Changing events slug

  • I wanted to change the slug from ‘events’ to ‘event’. I found a way to do it without hacking the plugin and wanted to share. Just add this to your theme’s functions file. Now I can add the calendar shortcode to the /events page. The new archive is /event and all posts use the /event/post-name slug.

    // Rewrite Sugar Calendar Plugin Slug
    function change_post_types_slug( $args, $post_type ) {
    
    	/*item post type slug*/   
    	if ( 'sc_event' === $post_type ) {
    	   $args['rewrite']['slug'] = 'event';
    	}
     
    	return $args;
     }
     add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.