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
- How to get pretty URLs with add_query_arg in permalinks
- How to Check if a Page Exists by URL?
- Use navigation path from menu for permalink
- Multiple post categories – single permalink
- Update URL Snippet to Canonical Permalink URL
- “.#[random-char-string]” being inserted at end of URLs
- Pretty Permalinks
- How to create a permalink structure for posts in a specific category
- List children of second level sub page
- How to get current page menu item name instead of full menu item list
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- custom permalink/shortlink with base62 encoded post ID
- Share parent path between Custom Post Types and Pages?
- Getting post content within wp_nav_walker
- wp_list_pages sort order is different for different languages [closed]
- list pages only from master parent
- Page-Linking Structure
- wp_list_pages: only show subpages on the parent page?
- How to reset canonical URLs / fix redirect loop
- How to Add a Rewrite Rule for Only One Page?
- Does loading of sub pages in menu cause load to the server?
- wp_nav_menu including Skype URL
- Making a custom help center page
- Custom Post type and permalink settings
- Add “page-a” slug to category link if user visit category link from “page-a”
- Link to Homepage in Menu
- Add class active to static menu
- Force wordpress to display page with same url structure as categories
- How can i have a custom post type with more slugs for each post?
- How to show the root webpage on all subpaths
- Programmatically add existing pages and subpages to Appearance Menu
- How to retrieve parent menu item name of current submenu item
- URL rewriting: removing the site’s basename for a specific category
- When clicking on menu item not going to specific page
- Ad custom admin page like WordPress customizer [closed]
- Host frontpage via example.com and everything else via example.com/blog
- Custom category URL rewriting
- Create custom page and add it in nav menu by code
- Does is_child() exist in wp 3.5.1?
- wp_list_pages sort order by custom nav menu order
- mod-rewrite exception? keep #hash in matching urls?
- How to highlight 1st level menu item based on actual page
- Prevent menu from loading in a page template [duplicate]
- Remove parent page from url
- How to add a page to header that is outside of WordPress?
- Highlighting top level link when viewing one of it’s sub-pages, which are not linked in the menu
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- Add (grand)child pages automatically to nav menu
- how avoid the link of the current post in the menu in the sidebar?
- Page appears after de registering from menu
- URL links consistent with menus?
- Dynamic menu wp_list_pages displaying only current branch including: current page, his siblings and its childs
- Add # to submenu URLs automatically
- wp_list_pages Hierarchical Help
- Parent Page > Child Page Menu
- Add pages content to startpage through custom menu
- Main menu navigation links and new pages
- Catagorized hierarchy menu for PAGES!
- When I click a custom menu link, how do I make it update the URL in the browser to the external link?
- sub.menu’s not working
- 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)
- 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
- adding pages in underscores.me theme
- How to get the Page Name of the current page?
- 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
- 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?
- changin the url (permalink as it goes these days) on one specific menu layer
- Change URLs in default WordPress slider to relative from absolute
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Unable to remove page from primary menu
- a way to support totally different url structure
- How to change URL of my pages?
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- Specific Page that convert Hyperlink to anchor in nav menu
- add custom entries to menu options
- Posts in Page – How to customize the URL?
- WordPress – Apperance > Menu
- How to change page location in WordPress
- 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?
- Site with all content on the front page
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- How to disable permalink of a particular menu item?
- Navigation menu displays permalinks
- Control page access based on User Meta data?