WordPress.org

Ready to get started?Download WordPress

Forums

Search custom fields table (14 posts)

  1. privatestorm
    Member
    Posted 9 years ago #

    How do I modify the search function to search the custom fields table (postmeta) in addition to the posts table? Is there an existing plugin or hack that already does this?

  2. privatestorm
    Member
    Posted 9 years ago #

    Hello? Anyone know the answer to this?

  3. jeronimo
    Member
    Posted 9 years ago #

    I want to know how to search my custom 'pages' which i have created with wordpress? is there a similar pluggin for this?

  4. jeronimo
    Member
    Posted 9 years ago #

    Found the page search puggin: http://randomfrequency.net/wordpress/search-pages/

    Your best bet for hcm is to do a good google search for wordpress plugins which can search custom fields.

  5. Kafkaesqui

    Posted 9 years ago #

    There was another thread on this as well, with a link to the old Wiki and a search hack for 1.2:

    http://wordpress.org/support/topic.php?id=12988

    Unfortunately search facilities in WP is not my strong point, so I'm not sure what it would take to get this up to speed in 1.5.

  6. privatestorm
    Member
    Posted 9 years ago #

    Before posting my original message I had already done those 2 things (done extensive searching via google and tried to figure out how to make the old 1.2 hack work with 1.5) and had come up with no solutions. I have no problem trying to hack the WP code to get custom field searching to work but my problem is that I have no idea WHERE in the WP code the search functions are located.

  7. nessievl
    Member
    Posted 9 years ago #

    I found the answer. Or rather i got someone to write one for me :)

    http://randomfrequency.net/wordpress/search-meta/

  8. privatestorm
    Member
    Posted 9 years ago #

    Great. Thanks!

  9. privatestorm
    Member
    Posted 9 years ago #

    This works great to certain a point, but I need further customization. How do I form a search query that will search for ONLY meta_values that are in the postmeta table AND are equal to a certain meta_key?

    Example:
    Search for format=CD
    where meta_key=format and meta_value=CD

    As it is now if I just do a search for CD any post that has the word CD in it will be listed. I only want the posts listed that have a custom field value of format=CD. Any ideas on how to do this? Does the search code have to be hacked further to get this to work, or is there already a way to select the info I want via a custom query string?

  10. ohdear
    Member
    Posted 9 years ago #

    Jerome’s Keywords, seems to be a little closer to what you're looking for - http://www.vapourtrails.ca/wp-keywords

  11. privatestorm
    Member
    Posted 9 years ago #

    ohdear - No that isn't what I'm looking for. But thanks for trying.

    To clarify: I'm looking for a way to form a search query for a meta_key AND meta_value combination, not just certain keywords in the meta_value field. There will be MANY different meta_key/meta_value combinations.

    At this point it looks like I'll just have to write my own plugin.

  12. ohdear
    Member
    Posted 9 years ago #

    Sorry, I just meant the plug-in was more relevant to customizing the search, more of a base to start off on, rather than meeting your requirements.

  13. djg
    Member
    Posted 8 years ago #

    Has anyone found an update/solution to this thread? It would be REALLY nice to be able to have an 'advanced search' that included things like this.

    e.g.

    Search:
    if custom_field_key == "xxx" and custom_field_value == "yyy"

  14. privatestorm
    Member
    Posted 8 years ago #

    I have not yet tried either of these but I found 2 other search plugins that might work:
    Jerome's Search - Simple plugin that replaces the default WordPress search with a slightly improved version that searches post meta values, post excerpts and pages.
    http://vapourtrails.ca/wp-plugins

    Pages Advanced - Pages Advanced is a plugin for WordPress. It gives you more advanced options for pages.
    http://www.lightvoid.com/wordpress_themes_26_plugins/pages_advanced_/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags