In my site the posts content is always the name of a school, so if I search for Chicago I get a lot of posts with different schools as content. What I want to do is to get the Schools with the most posts, so I could display this somewhere:

School A - 4
School B - 3
School C - 2
School D - 2

(The number at the right is the number of posts the school has)

So what I need to get the most repeated post contents from a particular search including the ones that don't appear in first results page.

I don't know how complicated it can be so if there is no simple way I would be very grateful for just being pointed towards the right direction, so I later figure out how to do it. My site is made with wordpress and the posts are on a SQL database. Please ask if it's not clear or for any more info.


  • You say the "school" is the post content. How can post content have posts? Dec 19, 2010 at 11:10
  • Can you perhaps provide a bare-bones example of what a given post's content may look like? Can each post make references to several schools or just one?
    – t31os
    Dec 19, 2010 at 13:36
  • The content is just the name of a single school/university or idk institute.
    – Lisandro
    Dec 25, 2010 at 19:40
  • @Lisandro: I think you should make use of custom taxonomies (Wordpress Codex). Then you can associate a specific school to an article and list / search / weight / rate based on that.
    – hakre
    Feb 6, 2011 at 16:55

1 Answer 1


The problem with your approach is that post's content pretty much ignored in WordPress query architecture. It is meant to be textual information, as opposed to technical meta information.

You have several options:

  1. Try to modify raw SQL of query request through filters, such as posts_where.

  2. Assign school name to custom field and use custom fields parameters in query (much enhanced in upcoming 3.1 version of WP).

  3. As per hakre's suggestion create custom taxonomy and assign schools to posts as its terms.

Your Answer

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