i have custom page on wordpress which is accessible in following way:
domain.com/custom-page/1
how could i achieve following url pattern:
domain.com/custom-page/1/Title-of-Page-Content
or
domain.com/custom-page/1-Title-of-Page-Content
it seems like after “custom-page” other then integer value is not acceptable.
Note:
i have tried .htaccess way and by adding following code in theme/functions.php
function custom_rewrite_rule() {
add_rewrite_rule('custom-page/([^/]*)/([^/]*)?$','index.php?pagename=custom-page&_id=$matches[1]&title=$matches[2]','top');
}
add_action('init', 'custom_rewrite_rule', 10, 0);
any help? Thanks in advance.
When you are in the Admin area of WordPress, go to the Settings pop out menu. There is an option for Permalinks. Go there and select the pattern you’d like for your page slugs. I think the specific one you want to select is Post Name, according to what you are saying.