Add querystring parameters to link_to

I’m having difficultly adding querystring parameters to link_to UrlHelper. I have an Index view, for example, that has UI elements for sorting, filtering, and pagination (via will_paginate). The will_paginate plugin manages the intra-page persistence of querystring parameters correctly. Is there an automatic mechanism to add the querystring parameters to a give named route, or do … Read more

Wp Login redirect strips parameters from url

If i write http://domain.com/wp-login.php?redirect_to=http://domain.com/specificpage/?parameter1=dog&parameter2=dog&parameter3=cat in the url address bar (to make the login page redirect to a specific page with parameters) and login. I get redirected to the right page but only with first parameter (http://domain.com/specificpage/?parameter1=dog). the other two parameters are stripped from the url. How can i solve that? Btw – the parameters are … Read more

Change URL parameters and specify defaults using JavaScript

I have this URL: site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=ModifiedTimeAsc what I need is to be able to change the ‘rows’ url param value to something i specify, lets say 10. And if the ‘rows’ doesn’t exist, I need to add it to the end of the url and add the value i’ve already specified (10). 31 Answers 31 I’ve … Read more

How to remove the querystring and get only the url?

Im using PHP to build the URL of the current page. Sometimes, URLs in the form of www.mydomian.com/myurl.html?unwantedthngs are requested. I want to remove the ? and everything that follows it (querystring), such that the resulting URL becomes: www.mydomain.com/myurl.html My current code is this: <?php function curPageURL() { $pageURL = ‘http’; if ($_SERVER[“HTTPS”] == “on”) … Read more

Passing array of strings to a SQL statement in a WordPress plugin

I have an issue with passing an array of strings to a SQL statement in a WordPress plugin, because the prepare method adds a backslash before each apostrophe. // I have an array of strings. $the_array = [‘red’, ‘green’, ‘blue’]; // I convert the array into a single string containing comma separated values surrounded by … Read more

Optional query string parameters in ASP.NET Web API

I need to implement the following WebAPI method: /api/books?author=XXX&title=XXX&isbn=XXX&somethingelse=XXX&date=XXX All of the query string parameters can be null. That is, the caller can specify from 0 to all of the 5 parameters. In MVC4 beta I used to do the following: public class BooksController : ApiController { // GET /api/books?author=tolk&title=lord&isbn=91&somethingelse=ABC&date=1970-01-01 public string GetFindBooks(string author, string … Read more

Can’t pass table to $wpdb->prepare

I’m having trouble passing a table variable to $wpdb->prepare(); Here is functioning code: $table = $wpdb->get_blog_prefix( $blog_id ) . ‘my_table’; $voters = $wpdb->get_row($wpdb->prepare(“SELECT * FROM $table WHERE user_id= %d AND post_id = %d;”, $user_ID, $post->ID )); This works great. However I think I should also be including my table in the prepare statement. But, it … Read more

How to read values from the querystring with ASP.NET Core?

I’m building one RESTful API using ASP.NET Core MVC and I want to use querystring parameters to specify filtering and paging on a resource that returns a collection. In that case, I need to read the values passed in the querystring to filter and select the results to return. I’ve already found out that inside … Read more

Query_posts $query_string

I have a query that looks like: query_posts($query_string.”&post_type=attachment&posts_per_page=9&paged=”.$paged); I’d like it to looks something like: $args = array( ‘paged’ => $paged, ‘posts_per_page’ => 9, ‘post_type’ => ‘attachment’ ); query_posts($args); I am trying to integrate $query_string into the query_posts with $args…can anyone point me in the right direction. Thanks, Josh 1 Answer 1 After some searching … Read more