Question

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?

Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top