Right now all pages path like /faq/ or /about/. I need path like /home/faq/ /home/about. I tried change url slug in edit page. But WordPress change my home/faq to home-faq.
I installed plugin Create And Assign Categories For Pages And add custom categories, but paths don’t changed.
How can I do this task?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
If you want to change the permalink structure for all Pages (i.e. posts of the page type), you can use the WP_Rewrite::$page_structure property like so:
add_action( 'init', 'wpse_382911' );
function wpse_382911() {
global $wp_rewrite;
$wp_rewrite->page_structure = 'home/%pagename%';
}
Don’t forget to flush the rewrite rules — just visit the permalink settings admin page (wp-admin → Settings → Permalinks).
But if you just want that structure for specific pages, then how about just using the parent-child feature whereby you’d create the home page and make the faq and about pages as children of the home page?
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0