WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a filter to display "standard" posts in a page by selecting category and it works well but it deletes "video" posts.

I need to create another filter to display the "video" posts from the category which is displayed, this filter isn't correct but i don't know how to do it...

Filter to show "standard" posts :

function website_inter_posts_where($where,$query) {
  global $wpdb;
  $new_where = " ({$wpdb->posts}.ID NOT IN (SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_format_video_embed' AND LENGTH(meta_value) > 0 ))";
  if (empty($where))
    $where = $new_where;
    $where = "{$where} AND {$new_where}";
  return $where;

How to do this?

share|improve this question
I tried to edit the question to put some meaning to it, but not happy with it, @kolorslab Can you explain a little more on it. – Maruti Mohanty Oct 30 '13 at 10:41
Hi maruty, in a page i list all the posts from a category and i want to show these in a page : the standard post (it's ok with my filter) and the video-posts form the same category. I have a standard post for each category and a few video posts for each one. Thanks – kolorslab Oct 30 '13 at 11:25
So you need to show in that page all the posts that are standard posts OR video-post of that category, right? – Lorenzo Oct 30 '13 at 11:52
By page do you mean custom page template? If so: is there any particular reason you're using a posts_where filter, rather than a custom loop via WP_Query()? – Chip Bennett Oct 30 '13 at 12:15
My page has 2 columns in the 1st column i show from the category who is selected the "standard" post of this category and in the 2nd column i want to show the "video" post of this same category. So in left column the standard post and the right column the video posts of the category variable. thanks jorghe – kolorslab Oct 30 '13 at 13:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.