Redirect Category pages to blog page with query string

Figured out the answer myself. Luckily, I had a lot of the requirements already set up and it was just a matter of piecing them together. I am using a custom nav walker, and the start_el function passes in an $item parameter that contains an object property, telling you what that nav item is (ie. a page, a custom link, or in our case, a category). I was able to use this information, along with a custom function I created for generating the category URL, to get the result I was looking for:

My_Nav_Walker.php

class My_Nav_Walker extends Walker_Nav_Menu {

    /* ... */

    function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
        /* ... */
        $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';

        $url = $item->url;

        if($item->object == "category") {
            $category = get_category($item->object_id);
            $url = get_category_url($category->slug);
        }

        $attributes .= !empty($url) ? ' href="' . esc_attr($url) . '"' : '';

        /* ... */

    }

    /* ... */
}

Custom Category URL Function

function get_category_url($category_slug) {
    return get_post_type_archive_link( 'post' ) . '?category=' . $category;
}

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