I use the following code to add the prefix:
add_action('init','change__permalinks');
function change_permalinks() {
global $wp_rewrite;
$prefix = 'us';
$wp_rewrite -> use_trailing_slashes = false;
$wp_rewrite -> $prefix . $wp_rewrite -> page_structure.'/%pagename%';
$wp_rewrite->flush_rules();
}
Related Posts:
- WordPress menu permalink redirects to wrong page
- Page header menu links change
- Two pages named the same thing, on a different level but conflicting url paths in menus and direct links
- Blog posts are not appearing as subs of Blog Page
- Highlighting top level link when viewing one of it’s sub-pages, which are not linked in the menu
- Three menus – parent / child / sibling
- Add custom path to url to specific pages
- Getting back a permalink from custom url
- How to making dynamic URLs for menus in WordPress?
- sub menu link is not working
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- Limit wp_nav_menu_objects() only to first-level menu items
- Add (grand)child pages automatically to nav menu
- how avoid the link of the current post in the menu in the sidebar?
- Disable parent in wp_list_pages – WordPress
- Bulk append URL (add word to slug)
- Page appears after de registering from menu
- How are WordPress Page URLs affected by permalink settings?
- Get parents child pages
- URL links consistent with menus?
- How to create cutom link for page
- Dynamic menu wp_list_pages displaying only current branch including: current page, his siblings and its childs
- wp_nav_menu without menu or theme_location specified
- I can’t add more pages to menu – menu delete pages
- Add # to submenu URLs automatically
- wp_list_pages Hierarchical Help
- Parent Page > Child Page Menu
- Making pages in a menu appear conditionally
- Add pages content to startpage through custom menu
- add_menu_page does not render the expected result
- Access posts while mod_rewrite is broken
- Main menu navigation links and new pages
- Catagorized hierarchy menu for PAGES!
- How to show pages in menu without link
- WP as a CMS menu
- Subdomains pointing to a permalink URL
- When I click a custom menu link, how do I make it update the URL in the browser to the external link?
- Add a menu metabox to post edit page
- Setting or plugin for showing submenus horizontally under the main menu, and keep them after selection
- sub.menu’s not working
- Can I change the URL structure for a CPT only?
- Keep source page URL parameters on custom link menu item
- How do I structure my permalinks in WordPress?
- Problem with links once in portfolio item
- How to link current logged-in user to their author page via URL (Beginner)
- Change the full permalink (URL) of a single post by connecting it to a specific page
- Page dependent sub-menu?
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- A different permalink structure for different categories
- Multiple Taxonomy Items for Separate URLs
- WordPress keeps removing query var from the URL
- adding pages in underscores.me theme
- How to get the Page Name of the current page?
- How to construct a dynamic rewrite rule for child pages that passes more than one query var
- Adding menu title to custum URL
- Add #primary at the end of navlink permalinks on single posts
- Swap out a page that is a parent to a many many pages
- Menu links URL with PHP GET method
- Using a template file for a specific custom URL
- Nested permalink without dummy parent page
- Only the index.php/homepage open while other pages are not opening
- Add CSS Class to WordPress Menu Item Dependent on the Page the User is Visiting
- Extra url paths as variable
- How can I order these pages in this navigation bar on this old wordpress theme?
- Passing parameter through permalink structure
- How to add a ‘News’ section to specific posts in WordPress
- changin the url (permalink as it goes these days) on one specific menu layer
- There is how to change url domain on some posts?
- How to make “single post” permalink maintain it’s sub-page structure
- WP pages content is missing in frontend
- Prevent Archive URLs
- Change URLs in default WordPress slider to relative from absolute
- rebuilding/ rewriting a url to make it SEO friendly
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Category URL to use same string as Post URL Permalink
- Unable to remove page from primary menu
- a way to support totally different url structure
- how to create pages and link them to a menu
- Change all pages permalinks instead of hierarchical to have id of the page
- How to change URL of my pages?
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- how to change single post link
- Any simple way to show 10 previous pages by id to current page in links as a menu
- How to add class and span to
- Custom post type with parent page? Possible?
- Specific Page that convert Hyperlink to anchor in nav menu
- add custom entries to menu options
- Posts in Page – How to customize the URL?
- Using categories and pages in menus
- WordPress – Apperance > Menu
- Menu Structure with Links failure to update
- Is It Possible To A Link To The Homepage From The Admin Sidebar?
- How to change page location in WordPress
- Is it possible to rewrite a page url Without setting the permalinks to Post Name?
- Use menu structure for permalinks
- Creating and populating custom nav menu (menu-item-position not working)
- Custom Permalink Base
- Change archive link to single post
- How to make a page to not appear in the menu when created?
- Remove link from Page name in navigation bar