Title: Filtering Loop
Last modified: August 20, 2016

---

# Filtering Loop

 *  [bobemil](https://wordpress.org/support/users/bobemil/)
 * (@bobemil)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/filtering-loop/)
 * I don’t get how to achieve a filtering function with wp_query. I have three links
   on top of my loop to let the user choose between showing 25, 40 or 80 posts per
   page. I don’t get how to make the clicked link fire the function to show the 
   amount in the loop. Sorry for my bad english. If you don’t understand I will 
   explain it better. Please help me with this one 🙂

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/filtering-loop/#post-3117551)
 * The links need to call the page with the proper number as an argument to the 
   link, something like this:
 *     ```
       <a href="http://mysite.com/my-page/?perpage=25
       ```
   
 * Then in the code for the template check for the perpage argument and re-issue
   the query using that as the posts_per_page value.
 * You will also need to alter the links generated by the pagination to include 
   the perpage value in order to pass it along to all subsequent pages.
 * The exact coding is probably too involved for this forum. You can post a job 
   request on [jobs.wordpress.net](http://jobs.wordpress.net) at no cost.

Viewing 1 replies (of 1 total)

The topic ‘Filtering Loop’ is closed to new replies.

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [links](https://wordpress.org/support/topic-tag/links/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/filtering-loop/#post-3117551)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
