Redirect to post after publish or update a published post

After see your code, I think that you are trying to redirect the user to the post after publish or update an already published post.

Your problem is not with get_permalink() function nor your permalink settings. Your problem is with the logic of your code. See how you set the value of $pl equal to the result of get_permlink but the returned value is the value of $location. Also, you are setting the value of $pl inside the if comparison statement, which is somehting you shouldn’t do.

Try this:

add_filter('redirect_post_location', 'redirect_to_post_on_publish_or_save');
function redirect_to_post_on_publish_or_save($location) {

    global $post;

    if (
        (isset($_POST['publish']) || isset($_POST['save'])) &&

        preg_match("/post=([0-9]*)/", $location, $match) &&

        $post &&

        $post->ID == $match[1] &&

        (isset($_POST['publish']) || $post->post_status == 'publish') // Publishing draft or updating published post

    ) {

        // Always redirect to the post

        $location = get_permalink($post->ID);

    }

    return $location;

}