WordPress.org

Ready to get started?Download WordPress

Forums

WP Custom Fields Search
Not searching custom post types (8 posts)

  1. gingram815
    Member
    Posted 3 years ago #

    The search does not return custom post types. Is there any way to get this plugin to search custom post types other than the default? It is working great for default posts.

    http://wordpress.org/extend/plugins/wp-custom-fields-search/

  2. mealtime
    Member
    Posted 3 years ago #

    Same here! Totally kills it. All my custom fields are in custom post types. Someone's got to have a solution for this.

    Otherwise, this plugin is awesome, but without custom post type compatibility, I can't use it :-(

  3. tprod
    Member
    Posted 3 years ago #

    +1 I think it's better to do it manually. This plugin does not have an upgrade since 2 years now :(

  4. vinnyred
    Member
    Posted 3 years ago #

    Not sure if this would work but through another thread, someone is trying to search only custom post types. A simple solution is to add a hidden field to the form.

    If this could be added to the form (inside the plugin) maybe it would work:

    This post has the discussion.

  5. iblastoff
    Member
    Posted 3 years ago #

    i tried that post above and added the hidden value (<input type="hidden" name="post_type" value="post type name" />) into the plugin code where it outputs the search form. it didn't work for me.

  6. iblastoff
    Member
    Posted 3 years ago #

    got it to work! in "extra_search_fields.php" you just need to throw in the custom post type name pretty much anywhere it says 'post_type'

  7. vinnyred
    Member
    Posted 3 years ago #

    sounds good, i'll give this a whirl - got a customer product dbase coming up... Thanks iblastoff

  8. elmediano
    Member
    Posted 2 years ago #

    @iblastoff - ABSOLUTE LEGEND!

    Just to clarify, there's only a couple of lines you need to change. Just make a search for "post_type" and you'll get around 5 results.

    You just need to change this bit:

    (post|page)

    for this:

    (post|page|your_post_type)

    Once you've done that:

    1. Go to the plugin settings and create a new field.
    2. Label: Give it a name (ie. Post Type).
    3. Data type: Choose Post Type
    4. Widget: Hidden Constant
    5. Widget config > Value: the_name_of_your_post_type

    That's all!

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic