Articles of query variable

How to add query parameters to all internal links?

I’m trying to add url query parameters to all internal links inside a WordPress blog. For example, client lands on the blog with this link: I want the links inside the blog, for example a link to a post, to still have the query strings: Is there is a way to do it?

Variable in array not working

I having an issue getting a variable to work for one of my arguments in a query. I am using a custom post type and category name as terms to determine which categories are displayed. When I hardcode the values into the terms it works fine, but when I use a variable it doesn’t seem […]

I can't fetch query parameters ($_GET parameters) with get_query_var

I am developing pagination for a list of posts in my plugin. I’ve added a custom parameter in my plugin_functions.php file: add_query_arg(‘pworkspage’, 1); As you can see it defaults to “1”. Now, whenever I visit the custom admin page of my plugin with that parameter in the URL ( my script can’t see the parameter […]

Custom permalink with pagination

I have a custom post type called news and in order to distinguish current and old news posts I have a custom field where the client can mark a news post as ‘archived‘. So my permalink rewrite code looks like this: function custom_rewrite_rule() { add_rewrite_rule(‘^news/archive/?’,’index.php?post_type=news‌​&news_archive=true’,‌​’top’); add_rewrite_rule(‘^news/archive/page/([0-9]+)?/?$’,’index.php?post_type=news&news_archive=true&paged=$matches[1]’,’top’); } add_action(‘init’, ‘custom_rewrite_rule’, 10, 0); function add_query_vars_filter( $vars ){ […]

Is there a plugin to record querystring parameters for a page (for customer tracking)?

I am creating an information landing page that I intend to cold email out to a bunch of potential clients. I need to track customers that not only open the email (I know how to do that) but track which email recipients actually navigated to the landing page. In a custom web application I would […]

Passing Variable as URL Parameter — Security concerns?

I need to make sure I’m not opening up a security hole in my site. I have a Custom Post Type called “Communities” and a custom post type called “Floor Plans” and need to add a parameter to the URL on Single Floorplan posts. My goal is that when a Floorplan post object is selected […]

add_rewrite_rule not working for page var

I have a page called mypage and a custom query var called mycustomvar, I am trying to rewrite the following url: to using add_rewrite_rule( ‘^mypage/([^/]+)/?’, ‘index.php?name=mypage&mycustomvar=$matches[1]’, ‘top’ ); But all I get is: showing in the url. I have also tried adding both add_rewrite_tag( ‘%mycustomvar%’, ‘([^/]+)’ ); as well as making sure […]

Rewrite rules and query for virtual page

My question comes from this one. I have never really touched on rewrite rules as frankly, they still do not make sense to me What I have I have successfully build the following link http://localhost/wordpress/custom-archive/ which should, by default, lead to a 404 page, as custom-archive does not exist. It is the same as visiting […]

Determine WP_Query parameters from URL

I’m wondering if it’s possible to determine WP_Query parameters by only using the given page URL. The reason I’m trying to do this because I’m developing a SPA theme (and ultimately a JSON response) and would need to be able to determine a query without reloading the page. Thought it’s pretty hacky, I’ve been successful […]

query_vars Filter: Would You Ever Use It When $_GET is Available and You Don't Need a 'Pretty' URL?

I’m having a hard time wrapping my head around the uses cases/best practice for the ‘query_vars’ filter, and query_vars in general, when I could use the $_GET global instead. Given If I’m not altering the query, I understand that it wouldn’t be appropriate to add ‘mykey’ as a query var. But if I AM […]