public function updateRewrite(string $postType, $args)
    {
        global $wp_post_types, $wp_rewrite;

        // Bail if page not set
        $pageForPostType = get_option('page_for_' . $postType);
        if (!$pageForPostType) {
            return;
        }

        // Bail if page not published or private
        $postStatus = get_post_status($pageForPostType);
        if (!in_array($postStatus, array('publish', 'private'))) {
            return;
        }

        // Get original rewrite rule
        $args->rewrite = (array) $args->rewrite;
        $oldRewrite = isset($args->rewrite['slug']) ? $args->rewrite['slug'] : $postType;
        \WpPageForPostType\Settings::$originalSlugs[$postType] = $oldRewrite;

        // Get the new slug
        $newSlug = $this->getPageSlug($pageForPostType);

        $args->rewrite     = wp_parse_args(array('slug' => $newSlug), $args->rewrite);
        $args->has_archive = $newSlug;

        // Rebuild rewrite rules
        $this->rebuildRewriteRules($postType, $args, $oldRewrite);

        // Update global
        $wp_post_types[$postType] = $args;
    }