$url = parse_url( $your_url );
$query = $url['query'];
$args_arr = array();
parse_str( $query, $args_arr );
if( isset( $args_arr['param'] ) ) {
$query_string = $args_arr['param'];
$query_string .= ',value2';
} else {
$query_string = 'value2';
}
add_query_arg( 'param', $query_string );
That’s completely untested, but you get the concept. Basically, wordpress is gonna want to replace what you have set in param
, so you need to get what you have in param, then add what you want to add to it. You can definitely make that into a function if you want to, depends on your usage case.
Related Posts:
- Pretty permalinks for search results with extra query var
- Does WordPress automatically do 301 redirect if I change permalink
- ‘post_type_link’ filter not working
- Update URL Snippet to Canonical Permalink URL
- Broken wordpress permalinks on pages only
- Post being redirected to attachment post
- SQL Statement generated by WP_Query not producing expected results
- Change website URL without breaking links or images? WP 3.3
- Redirect user if it’s not logged in
- Random Alphanumeric Key URLs
- How to get this JavaScript working with get_permalink
- Add a css class to a taxonomy permalink
- Search result permalink
- Permalinks Structure and 404 Question
- Rewrite URL for results of a custom WP_Query
- Change of permalink structure – redirects in htaccess breaks the archive links
- Change permalinks with ACF values
- template_include not loading -instead goes to index.php
- Changing Custom Permalink with Filter
- WordPress installation in subfolder not working with nginx
- Link to external URL
- Confusion about how a URL is being parsed
- Clean install – Changing permalinks in twentyeleven give 404
- Adding page links to content that automatically convert to pretty permalinks?
- Need Help Correct Regular Expression Redirect Code
- WPML get permalink to the translated post from the original post
- issue with setting up permalink programmatically
- changing permalink for custom template in posts of a certain category
- WordPress post-name permalink redirects to site.com
- WordPress Pages Redirecting to Root with WordPress Multisite (Sub-Directory)
- get_permalink() is not working after published
- WordPress add_rewrite_tag working for Posts, but not working for Pages
- Woocommerce subcategory 404
- WordPress always returning 404 page for a specific url
- WordPress Automatic Update to 3.9.1 breaks Permalinks [closed]
- Static Text in Permalink
- Pre-populate Slug / Permalink with URL
- Permalink changes gives me 404 [closed]
- How do I make 301 redirection from `/%post_id%/` to `/%postname%/`?
- Allow Permalinks to Work with and without Hyphens
- WordPress permlink is not working
- Problems with rewrite rule
- How to Custom Edit Post Title & Permalink Slug?
- Problem with parent page slug only in WordPress admin
- Broken wordpress site, non-working links and no access to wp-admin page
- How can I get the list of all pages URLs including their shortlink IDs?
- How do I remove /wordpress/ from my permalinks?
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- Page found with “Plain” permalink but not with “Post name”
- Post Name Permalink setup gives 404 error inside sub-directory
- How to use Specific URLs for some posts
- Change permalinks for specific pages
- Page redirect to 404 when set Permalink = “Post Name”
- How can you create a Permalink structure on a WordPress site?
- How to enable http (not just https) in wordpress?
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Multiple Tags Issue in Permalinks
- Is there a way to show attachment IDs on the attachment info screen?
- Keep permalinks in WordPress
- Auto Changing Text Case
- Need to capture “keyword” added to the end of the post, even with “pretty permalinks”
- How to get related taxonomies based on a category with mysql query?
- What permalinks do I use in the redirection
- Is it possible to change the permalink structure without changing the old permalinks to posts and without 301 redirects?
- WP Multisite Subdirectory Custom Permalinks 404
- Adding a ‘blogs’ prefix in the URL structure but only for blogs
- Whole site’s pagination not working after rewriting product permalink
- Convert $ _GET to permalink
- Permalink blog page (only) not working
- Link to a page before launch
- How to redirect old permalinks to ones generated by [WP-Hashed-ID] plugin?
- How to create a standard WP Page that has the same url as an archive
- One post but two separate permalink structure and template views
- permalinks constantly needs re-saving
- Link to a custom page without a permalink?
- How to change permalink for pages in WordPress?
- Disable “similar permalink” redirect [duplicate]
- Why aren’t my posts being saved or published?
- Retain Post title keywords in URL even if user changes post title or any other way to achieve SEO friendly permalink?
- How to change the URL using rewrite rule in wordpress
- Permalink not working in Apache on Linux
- Page permalink redirects to home page
- Changing Permalinks. Old links don’t work
- WP Job Manager Custom Permalink Returns 404 Errors
- How to make custom page link to root automatically?
- I have to specifiy port otherwise the website doesnt work
- Permalinks for thumbs with get_post_gallery
- Permalinks/Pretty links aren’t working on my site
- Permalinks – Archives
- Dynamically populate permalinks
- Redirect Pretty Permalinks to Ugly Permalinks
- Slug adding -2 even though the other posts with the same name is in a separate post type
- Create a permalink for a post’s attachments
- how to create several url aliases for a page
- Post URL not working according to permalink setting
- Strip category base from URL?
- Does the error “A structure tag is required when using custom permalinks.” mean my permalinks haven’t saved?
- Custom Permalink Structure For a Specific Category
- Error: “Sorry, this content could not be embedded” when using the Embed block
- WordPress not remembering old slugs for pages