Skip to main content

Timeline for Paginate pages with dynamic query

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Apr 13, 2017 at 12:37 history edited CommunityBot
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Jun 13, 2013 at 21:06 comment added tyler I will give this a go and see what happens. Currently I pass an array of fields like so: $arrays=array( array( 'key' => 'attraction_type', 'value' => $attraction_type, 'compare' => 'LIKE' ), ... more arrays where the variable corresponds to the field value. Then I query the posts and filter out the ones that don't have the selected checkbox amenities. Previously I passed the checkbox array to my meta_query array and it weighed the loadtime down and crashed the site.
Jun 13, 2013 at 20:13 comment added s_ha_dum And you are not just shoving that form data into the query unprocessed are you? That is a dangerous thing to do if you are.
Jun 13, 2013 at 20:12 comment added s_ha_dum But you are not passing that form data when someone clicks a link. The initial form submission works, I assume, but you need to pass that data along with the pagination links-- you have to if you want the pagination to work, unless you use something like $_SESSION or cookies which are more complicated solutions. You can pass arrays through a GET string, just use square brackets-- &meta_value[]=value1&meta_value[]=value2 and so on.
Jun 13, 2013 at 20:06 comment added tyler I will definitely add get_permalink(), thanks for catching that. I never thought about passing my meta key/values to the link itself. The main problem with that is my search form has checkboxes so I am actually passing the meta_query an array that contains all fields of the form some(checkboxes) being arrays themselves.
Jun 13, 2013 at 19:44 history answered s_ha_dum CC BY-SA 3.0