Open the page with the current slug?

First, I put the following rewrite rule in functions.php:

    function custom_page_rewrite_rule() {
        add_rewrite_rule(
            '^category/([^/]+)/([^/]+)/?$', // Matches /category/news/add-new-post/
            'index.php?pagename=$matches[2]', // Loads the page by slug
            'top' // Priority
        );
    }

add_action('init', 'custom_page_rewrite_rule');

And then changed the “Add New Post” button’s link to this:

<?php echo '<a href="'.home_url("category/news/add-new-post/">'; echo "Add New Post";'</a>';

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