Custom post type URL – filter by taxonomy

Hope you did pretty url on your site already (Settings>Permalinks). If so, Let’s guess your Category base is blank there.

You have to add Custom posts in category archive using a filter. To do so, add this to function.php:

function go_add_custom_types( $query ) {
  if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set( 'post_type', array(
     'post', 'nav_menu_item', 'your-custom-post-type-here'
        ));
      return $query;
    }
}
add_filter( 'pre_get_posts', 'go_add_custom_types' );

In default setup, WordPress Structure act like this (Based on observation on my blog)

For Default category,

site.com/category/catgory-name

or site.com/category-name

For custom taxonomy (by chance)

site.com/custom-taxonomy-slug/category-name

For single news (CPT)

site.com/news/post-name.

For single Default post:

site.com/<depends-on-permalink-structure>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)