Conditional Permalink based on category?

Answering My own question..

That was easier than I though.. I used the post_link filter to modify the permalink in the following way..

function custom_permalink( $permalink, $post ) {
    // Get the categories for the post
    $post       = get_post( $post_id );
    $category   = get_the_category( $post_id ); 
    $post_year  = mysql2date("Y", $post->post_date);
    $target_cat = 6; // Category we'd like to change permalink for

    if ( empty( $post_year ) ) return $permalink;

    if ( $category[0]->cat_ID == $target_cat ) {
        $permalink = trailingslashit( home_url( $category[0]->slug . "https://wordpress.stackexchange.com/" .$post_year ."https://wordpress.stackexchange.com/" . $post->post_name . "https://wordpress.stackexchange.com/"  ) );
    }

    return $permalink;
}

add_filter( 'post_link', 'custom_permalink', 10, 2 );

And of course, flushing permalinks by visiting the settings > permalinks page.

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