Custom Query String Plugin 2.2

This plugin, only for WP 1.5, will allow you to set the number posts to show for all the different “query views” and each your categories in WordPress. You can choose how many posts or days, and what to order them by, for any of the queries and/or categories. All this easily set from an options page within the admin area.

Find out more at the project page.

Custom Query String Plugin 2.2 was written by


The opinions expressed in comments are entirely the responsibility of the various contributors. While I will do everything within reason to ensure that they are not defamatory, I accept no liability for them or the content of links included in them.


Thanks for this. It is very helpful. Just surprised this is not an option in the WP core.

I have just read a thread in WP support pages and I understand you “have plugins” for this. However, still think it would be nice to have the option in the core WP to either display archives as: 1) limited to X posts (and X could be different from the main page). 2) All posts

In the 1) option if you only display X posts and there are more then it should automatically add PAGES.

Just a thought… thx anyway!

Cheers, bugs.


I think someone changed the password at your other site


Paul, yeah some bright arsehole decided to take over the blog, and changed everything. so now I’ve changed it all back and stopped letting people login as admin. now use the login/password: test/password.


Great Plugin Matt! I was wondering how (or if I can) to go about changing the ordered by, say for date - I want it in chronological ASC and right now its going reverse (desc)?

Thanks for any help! Sue


Sue, you’re in luck. I just released version 2.0.1 which adds that option. The code is much cleaner too, and should help speed up load times.

NOTE: Click on “Delete All” after you upgrade, because the options are different and you’ll need to reset all your conditions.


Okay… I’ve installed the plugin (using WP 1.5) and activated it. When I go to the options/CQS, all that is returned are graphical links to WordPress and FireFox. I see absolutely no options/content as written in the .php file itself.

I’ve even played with file permissions… nothing changes. Could there be a conflict with another plugin, perhaps?


This is the greatest plugin I have ever seen. It’s sutch a fantasitc and simple idea, yet nobody has done it. If I knew whare you lived, I’d buy you dinner. Thank you so mutch.


I have the same problem as MCoenen: plugin 2.01 is activated but nothing shows when I click in the CQS tab.

I’ve checked for conflicts, and these are the ones that cause the problem:

WP-Contact form (v1.1) Get Recent Comments (v1.0)

I’m going to deactivate them to configure CQS and see if its just the config screen that has the conflict.


Here’s my report after some further testing. I disabled the conflicting plugins (WP-Contact Form 1.1 & Get Recent Comments 1.0) and the CQS options screen came up fine. I set up some rules and then reactivated the above two conflicting plugins. My blog is displaying as per my CQS settings (10 posts on home page, -1=all posts on most other pages). And as expected, the CQS config screen in my dashboard comes up empty aside from the header and footer.

Matt, thanks for a great plugin. I’m content with this workaround but would be happy to help with further testing if you’re going to squash the bug. If it is, in fact, a bug with your code and not WP.


I attempted to get the plugin to work but apparently it conflicts with more than get recent comments. It didn’t matter what I deactivated, I still came up with a blank page for CQS in the options area. Any idea for how to get this to work without deactivating an entire plugin collection? This plugin is what I’ve been looking for — a way to display archives differently, etc. Thanks in advance.


DebWire: it looks like this is a bug in WP1.5 that affects plugins that access the options pref pane in the dashboard. It think the bug has been fixed in WP 1.5.1 but I don’t have that version installed—I’m still running 1.5—and haven’t looked into installing the nightlies.

As per my post upthread, you don’t have to run with all of your plugins deactivated, but you need to deactivate the conflicting plugins in order to set the configuration on the CQS plugin. For my site, I did the following:

  1. deactivated all of my plugins except for Custom Query String
  2. set the options in CQS in Options->CQS
  3. left CQS activated and reactivated all of my other plugins

It broke a lot of stuff on my blog for the 3 minutes or so that I spent configuring CQS. Now everything seems to be running fine.


According to Owen at, another solution is to use the 1.5.1-alpha version of the menu-header.php. The comment I’ve linked to has a download link for said file. I’ve installed it on my system and everything’s happy now. No deactivated plugins, no empty config screens.

Disclaimer: mixing files from different versions of WP could do bad things. Make sure you have a backup before you start messing around.

Sorry to keep spamming your site, Matt. I’ll shut up if you want. Just let me know.


Ed Pas, MCoenen, Debwire, this is quite strange. I will attempt to see if I can reproduce the error, although I’m running 1.5.1 alpha.

Ed Pas, yeah bug #902 is cause of many problems like this and could possibly be the cause of this. I would apply the patch that they give there. Also thanks for the debuging, I love when other people solve my problems, so comment all you want. Nice job.

So everyone go get the new menu-header.php file, or apply the patch manually, it’s only two small lines to edit. Hopfully that will fix everything. If not please let me know.

Also note the CQS options page is only available to user_level of 9 or greater.



I have put together a patched file for WP 1.5 to fix Bug #902. Just upload replacing the current file.

Get the patched file: menu-header.php


Works now since I uploaded the patched menu-header.php file. Thanks for your help… GREAT plugin… (also not sure why this isn’t a core WP option, either).


Matt, just to clarify from one of my posts above:

It broke a lot of stuff on my blog for the 3 minutes or so that I spent configuring CQS. Now everything seems to be running fine.

The “breaking” was the stuff on my template that required the deactivated plugins (recent comments, contact form, etc.). It had nothing to do with yours. This seems obvious, but could be misinterpreted.

And with the WP patch applied, everything does, indeed, run fine.


I find your plugin very useful but I what I need for my site is slightly (I think) different functionality. I need a plugin that lets you set the number of posts per page depending from category. So in category news I would like to display 10 posts per page and in category work 5 posts. Can you please suggest me how can I modify your plugin to accomplish this.

Thanks for any input.



thank you for making this script. Much like Nicola however, I’m looking for a different approach. It would be nice to see a plugin that let’s you modify the number of posts and sort key/order for each of the categories.

I want all my categories except those under let’s say “Category X” to be ordered by postdate DESC (like any other blog), but for “Category Y” I want it to be postdate ASC or maybe postname ASC.


Matt… Thanks for the plug-in. I want to give it a try, but I am having a problem even more troublesome than what has been described above.

I added this plug-in. So far it is the only active plug-in. I JUST installed and downloaded the WordPress yesterday (I am very new to blogging and WordPress especially). When I click on the CQS link, I get a message that there was no input file specified and then I look at the url in the address bar and I got this: http://{my domain}/wp-admin/D:/clients/{my domain}/wp-content/plugins/custom-query-string.php (The {my domain} is where my domain name goes.) What I can’t figure out is why it is putting in the drive letter path….

Any ideas?


Please change your Options Menu code…

It should have basename(FILE) instead of FILE /* * Add options page link to admin menu. * Only accessible by user_level of 9 or greater. */ function cqs_options() { add_options_page('CQS Options', 'CQS', 9, basename(FILE), 'cqs_options_init'); }


Those FILE s above should have double underscores on either side. (They were stripped from my post.)


One more comment: (FEATURE REQUEST)…

Would you please be able to make it so that the query can be customized not just for is_category() but also for specific categories? I would like certain categories to have an ascending order but others should be in descending order. Is that possible?


Nicola, Kimiko the Furball, Jeff Mikels,

I added support for sorting on a per category basis in 2.2. So upgrade and hopefully it will all work as planned.


Try upgrading to the recent version 2.2. Should work now.


Hello, Thanks for the plug-in. It’s working really nicely on my art site. However I did find one bug. If you customize your permalinks to display the name instead of the number ID the plug-in will not recognize the categories anymore and thus it won’t work…

It’s not a big deal over all since I just returned to using the number ID’s but I do wish I could use the more descriptive permalinks instead. I’m using WP version 1.5.1.



I’ve reread your entry several times and I still cannot find the link to download this plugin! Has it been removed?


Candice, OOPS! My fault, it’s back up now hahahah


This plugin helps us to overcome a minor “mistake” of WP 1.5, compared with 1.2 - > a more user friendly archives view. Thks a lot for it.


Great program thank you!

One request. I was wondering if some sort of page function could be incoperated into the program. For large categories and for when people use the month option and don’t understand using the calendar. I want all the posts available in a x post per page format. and at the bottom have a next page link.


Hi there,… any luck that this will be updated for WP 2.0?


Hi there. This could be a really nice thing to use in WP 2.0… Any luck?


I have the same queries as the 2 above me, Jeremy and browserd. I know this sounds stupid but if I can’t continue with this plugin for Wordpress 2.0, I might not upgrade it because my blog really depends on it…lol.

Hope to hear a reply soon!


2.7 is out, which supports WP 2.0! ;)


Get the latest information on Estate Planning and wealth Management.


ANMsoft is a software outsourcing Indian company with clear focus on high quality, timely delivered and cost-effective offshore software development services. With our experience in providing offshore software development, project management capabilities and standards, ensures us to develop solutions that give your business an edge. Our global software outsourcing model delivers maximum targeted result.


Offshore software development by anmsoft focus on e-commerce & banking solution. we offer offshore development onsite / offsite consulting service for shopping sites, E-Store, travel, matrimonial and other banking & e-commerce solutions centre at ANMSOFT, Mumbai India.


Great plug-in!

Found out about it at and just wanted to let you know that the plug in description doesn’t show because of a problem with the character encoding (not UTF-8?)

Thought you’d like to know…

Related Posts