How can I display an archive of only one category of my custom post type?

Try this and let us know if it works:


function custom_category_rewrite() {

    /**
     * Here you build an array containing the post type keys that you want
     * the rule to work for.
     */
    $custom_post_types = array('podcast');

    foreach ( $custom_post_types as $post_type ) {
        /**
         * Adds rewrite rule which will rewrite sth like http://yoursite.com/podcast/category/category-name/ to
         * http://yoursite.com/index.php?post_type=podcast&category_name=category-name
         */
        add_rewrite_rule( "^$post_type/category/(.+)/?$", 'index.php?post_type=" . $post_type . "&category_name=$matches[1]', 'top' );
    }

    flush_rewrite_rules();

}

add_action( 'init', 'custom_category_rewrite' );

Put the code within your functions.php.

Pay attention to the comments along the snippet.

Try accessing something like http://yoursite.com/podcast/category/category-name/ to perform a test.

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