you can add a parameter with a new rewrite rule like that :
add_action("init", function () {
add_rewrite_tag("%countryName%", "([^&]+)");
add_rewrite_rule(
"^company/([^/]*)/country/([^/]*)/?"
, 'index.php?company=$matches[1]&countryName=$matches[2]'
, "top"
);
});
After adding this code, flush the rewrite rules of WordPress.
Then you can use URL like http://example.com/company/company-abc/country/UK
And then in the template, you retrieve the parameter with get_query_var("countryName", NULL)
Related Posts:
- get_post_type on post.php
- My own metabox checkbox plugin only saves the last value I’ve checked
- submit posts by unregistered users in wordpress
- Calendar Solution: Handling upcoming Dates with Posts?
- Is there an easy way to flag posts in the admin area?
- All of my custom posttypes are 404’ing
- finding whether request is for post, and post id
- Any built-in function to associate a post to category through a plugin?
- Save / Show multi line text in metabox
- How to hide some section in WordPress under Post
- Display post lists in 2nd paragraph
- Can’t delete Draft Post [closed]
- Matching Chapters to a Custom posts [closed]
- WordPress comments not appearing in blog posts, likely because of Redux template. Could I fix this with a plugin that adds a comment form as a block? [closed]
- WordPress display breadcrumbs using Yoast plugin [closed]
- Outbound link autometic converted into linkdirect , and not opening
- PHP basics help in WP context – remove a class/function?
- Display by Category in Admin
- Preg Match All doesn’t Allow echo first character for WordPress Taxonomy Tags
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- Two problems on my WordPress installation [closed]
- posts comments goes to trash
- Contributive page where people logged in can write
- Excerpts on category page
- How to remove plugin metaboxes from edit.php
- How to pull email and name from Flamingo plugin
- How can I make my metabox appear?
- Which widget to use for display category post with view more? [closed]
- How to inform the user that the save was not successful?
- External RSS feed to WordPress Portfolio
- Trying to fix form resubmition with PRG (Getting error: Cannot modify header information – headers already sent by)
- Display wordpress post’s in popup?
- Show meta box only when post is being published first time
- Retrieving Meta from Image Attachment
- Unable to add TAB character to post?
- how to add text to posts from tags
- WordPress metaboxes – textfield suggestion automatically populated
- Add category selection to custom post type (plugin)
- Redirect to another page using contact form 7? [closed]
- Why are my queries interfering with the global post variable?
- Would Gutenberg be considered a PlugIn?
- pagination on data fetched using SQL query
- How to delete all trashed item in one-go
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- How to get the first post and second post in a wordpress blog?
- Is it possible to send blog posts via email to subscribers?
- Custom setup of wordpress comments that are displayed
- Is there any plugin which can paste a common content to my every post?
- Recent posts per category loop?
- ‘Organize Series Plugin’ as muti author feature
- Finding the screen id of a page generated with add_menu_page
- Import Instagram post to WordPress blog post
- Problem of encoding characters (apostrophes) in my posts publications
- How to backup single post in wordpress [closed]
- How to get all posts belongs to a user between a certain date
- Date format – Meta Box plugin
- How do I publish portfolio items with a future date?
- wordpress content .php file in an iframe’s src in a wordpress post
- Meta Box by Rilwis, Load metabox on all page templates EXCEPT the homepage
- Making my plugin create a page?
- Is there a way to make the main page only display a brief description of the full article?
- How to change the post form from plugin?
- WordPress plugin Post Creation [closed]
- Don’t publish/update a post when a plugin finds errors in custom fields
- Allowing users to Sign-up > Login > Post articles that need approval
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Adding custom meta boxes to specified custom post type
- posts from multiple post types in one slider
- How to display the featured post on the category page?
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Access post title from custom meta box on title change
- Flickering sidebar when scrolling page [closed]
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- Moving FB comments at the end of page
- Where Should i write the code for wordpress ajax voting?
- download button for audio file in post [closed]
- check uncategorized category by default
- Print posts category or tag as a formatted journal
- how to execute some code after a post is published in WordPress [duplicate]
- Post status doesn’t update to ‘future’ every time?
- Function added to hook “new_to_publish” not executing – custom plugin
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Creating an admin meta box to save post as pending
- trigger email when post is published by someone a user follows
- Grab ID from post from plugin and use it to create an object
- Article content navigator in wordpress like mbaskool website
- WP::is_main_query() Not Working
- I would like to remove date display on photo preview
- Post deleted in trash [closed]
- Getting a list of the published posts
- How to relate 3 wordpress components with each other (Create database relationships)
- Change website directory safely to add a static page on startup
- add_meta_box creating default form field types
- Should meta boxes for specific pages be save in their own plugins?
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- If post exists in the database – each time goes on `else`
- Custom Template for wordpress cpt plugin
- Embed PDF into wordpress
- Hook Scripts and Styles in WordPress
- Get data from wp_posts of mysql in to variables of wordpress-php script