This can be accomplished with WordPress’s internal rewrite system by using add_rewrite_rule
and adding a query var.
function wpse47506_rewrites_init(){
add_rewrite_rule(
'about/case-studies/([^/]+)/?$',
'index.php?pagename=about/case-studies&clientname=$matches[1]',
'top' );
}
add_action( 'init', 'wpse47506_rewrites_init' );
function wpse47506_query_vars( $query_vars ){
$query_vars[] = 'clientname';
return $query_vars;
}
add_filter( 'query_vars', 'wpse47506_query_vars' );
This would go in your functions.php file, then visit the permalinks settings page to flush rewrite rules.
You can access the value of the query var in your page template with:
<?php echo 'Hello ' . get_query_var('clientname'); ?>
Related Posts:
- How to Add a Rewrite Rule for Only One Page?
- category slug and page slug same
- WordPress rewrite rule for specific page and second parametr doesnt work
- Is it possible to rewrite a page url Without setting the permalinks to Post Name?
- What is the difference between $paged and $page?
- Custom SQL Query for WordPress page
- Change admin startpage to Pages-page?
- How restrict page for users logged? [closed]
- Only allow new subpages to be created
- Can I write ‘RewriteCond’ using ‘functions.php’?
- Hide Visibility Option From WordPress Publish Metabox
- How to make nested page structure?
- Redirect to a page if ancestors is empty
- Get Order of Meta Box in a Page/Post
- Check to see if page exists problems
- Modify Page Title before output via wp_page_list
- List Child Pages of Parent Parent Page (Child pages from Grand Parent)
- Custom /page/2/ template (different from index.php)
- How to add meta boxes to Pages
- Rewrite rule to load images from production does nothing
- Overriding the currently selected menu item
- Front Page not showing on Pages
- Missing parent page attribute
- Hiding Page by Title from Editing
- Two Search pages, One search form
- Why doesnt ONE of my links in the footer work properly? [closed]
- Create subpage – filter parent pages list
- Use lots of pages, or categories/posts?
- How to have custom tinyMCE buttons break onto next line when too long
- Get page by its ID and display it on another one
- How do i change page template in bulk?
- Determine page content based on page parent
- Rewrite wp-login.php URLS to static pages?
- Rewrite custom post type URL parameters
- Weird issue with is_pages() with array
- Missing ‘Page Attributes’ in page edit
- How to show the root webpage on all subpaths
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- New user Registration data imported into Page
- Could be a namespace conflict (?) with login form and register form on the same page
- The concept of non-blog content
- Loading Multiple Comments Pages via Ajax?
- Change base URL of pages created by certain users
- Remove Content edit box from ALL pages (not posts)
- What is full URL for a post?
- How to list a page tree?
- How to create a page and display only the posts with a specific custom field value?
- Remove comment section from new page
- WordPress pages not working out correctly with HTML
- Change page name in admin list
- WordPress rewrite does not work for some reason
- Folder wordpress page redirect
- Dynamic page with comments
- How to rewrite a page url
- Manage content on multiple pages synchronysly?
- Display pages in alphabetical order
- Print page content with formatting when doing custom SQL query
- get_page() – Only variables can be passed by reference
- Is there a template tag/function for getting the URL (or slug or name or ID) of the blog page when using a “static” front page
- Problems in creating a static site with WordPress
- Creating new page/tab in groups section not working! [closed]
- Prompting for review / reapproval of page content
- Limit the amount of main pages
- Add separate list of pages under Admin
- Custom user tables not working after migration
- remove “Edit” from select pages
- Add custom action to the page listing screen
- How to list pages from an author?
- Add the same content to multiple pages
- Cannot update page – with too many characters?
- Share a folder with files
- Front Page post mirroring revisions to other pages, constantly updating itself
- Is it possible to embedd this web app to my website [duplicate]
- Using external DB within wordpress
- Microsoft Security Essentials is blocking my WordPress website in IE11
- htaccess and redirect to new url using regex
- Author information on all pages
- My pages disappeared from the list
- Pre-populating new Page creation with shortcodes
- WordPress Pages “allow comments” meta option can’t be checked
- Loading internal page
- Firing page_publish where page is child page
- Add role and edit page capabilities
- Google indexed pages for one page site
- WordPress, page 2 shows the same posts as page 1
- Parent for a single (single.php)
- Create a new page for each form selection
- pagination does not work with query_posts. Help! [duplicate]
- Subpage Conditional
- How can one get page by pagename if it is a child page?
- Archive with specific keyword by category sorted by date
- How to pass the Querystring in pages?
- I have over 3000 child pages – but I need a different main page
- How to enable automatic search results in WordPress
- How to make a conditional statement that checks if the page is the child of a certain page?
- Edit the text location of a form
- How to customize the author page in wordpress?
- User profile in front-end
- custom css in one page
- Why is a page shown with ‘hidden’ next to the name in the list of pages if the page is set to public?