I have a WordPress site in a subfolder like this: www.example.com/TEST
. I want to rewrite a URL for a specific page which is from post_type = page
.
For example, I have a page like this: www.example.com/TEST/albama-test
And I need end result URL to be like: www.example.com/TEST/albama-test/blog
How do I achieve this?
I tried to use add_rewrite_rule
but it’s not working for me.
function custom_rewrite_basic() {
add_rewrite_rule('^blog/([0-9]+)/?', 'index.php?page_id=1053', 'top');
}
add_action('init', 'custom_rewrite_basic');
Try this code