I have two type of posts: Custom Posts and Wordpress regular posts. 
I want url to be like that: 

`/category-name/post-name/` for Wordpress Regular Posts and 
`/post-name/` for Custom post. 

I was able to achieve needed url for Custom posts: 

```
function remove_base_slug( $post_link, $post, $leavename ) {

    if ( 'trip-options' != $post->post_type || 'publish' != $post->post_status ) {
        return $post_link;
    }

    $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );

    return $post_link;
}
add_filter( 'post_type_link', 'remove_base_slug', 10, 3 );

function check_parse_request( $query ) {

    if ( ! $query->is_main_query() || 2 != count( $query->query ) || ! isset( $query->query['page'] ) ) {
            return;
        }

        if ( ! empty( $query->query['name'] ) ) {
            $query->set( 'post_type', array( 'post', 'trip-options', 'page' ) );
        }
    }
add_action( 'pre_get_posts', 'check_parse_request' );

```

As for Regular posts, i tried to do that through `WP Dashboard -> Settings -> Permalinks` and set up it as `/%category%/%postname%`. This way it works for regular post, but break my custom posts url. 

Is it any way for me to keep desired url structure for both type of posts?

So i need something like: 

```
  if (get_post_type() === 'trip-options') {
     /* URL shoud be /post-name/ */
    }
    else {
      /* URL shoud be category/post-name */
    }

```