1

I have a custom page, in that page i am using a custom select query for my search functionality.

The problem is pagination not working. I used $on_page= get_query_var('paged'); for pagination. When I echo $on_page, it always return 0 as the result. I am using a custom theme (soundwaves) for my site.

This is my query:

$resultsTotal = $wpdb->get_results(
    "SELECT p.post_title,p.ID,pm.meta_value 
        FROM wp_posts p 
        join wp_postmeta pm ON p.ID=pm.post_id 
        WHERE  pm.meta_value 
                LIKE '%$track%' AND (p.post_type='post' AND p.post_status='publish')  
        GROUP BY p.ID"
);
  • 1
    Please take a look at like_escape() and meta-query. – kaiser Apr 26 '13 at 11:35
  • Please post all of the relevant code. As is, I can't see why you need a custom SQL query at all. – s_ha_dum Apr 26 '13 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.