Retreive post from custom field value


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $querystr = "
  4. SELECT wposts.*
  5. FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
  6. WHERE wposts.ID = wpostmeta.post_id
  7. AND wpostmeta.meta_key = 'tag'
  8. AND wpostmeta.meta_value = 'email'
  9. AND wposts.post_status = 'publish'
  10. AND wposts.post_type = 'post'
  11. ORDER BY wposts.post_date DESC
  12. ";
  13.  
  14. $pageposts = $wpdb->get_results($querystr, OBJECT);
  15.  
  16. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.