WP Custom Fields Search
not working for custom post type post search (5 posts)

  1. prabhu.swain91
    Posted 3 years ago #

    I have a custom post type and there are many custom fields in it.
    I have installed this plugin . working fine in wp-admin.
    i filtered search also to my needs.
    but when i am trying to search on the frontend its always showing 0 results.
    Can i have a solution please ??


  2. don benjamin
    Plugin Author

    Posted 3 years ago #


    If you are searching for custom post types you will need to add a hidden input to the search form. It should be set up as follows:

    Data Type = Post Type
    Widget = Hidden Constant
    Compare = Equals
    Constant Value = <your-post-type>

    Without this, by default the search will be limited to only posts of type "post". <your-post-type> should be the post type as it is stored in the post_type field in the database.

    If you're not sure what the post_type value is you could change the Compare to "Words In" and leave the Constant Value blank. This is a bit hacky, but will work for now.

  3. Manish
    Posted 3 years ago #

    Tried as you said above but it doesn't work with my custom post type.
    I am using classipress. Pls see http://www.PuraniCar.com

  4. mfalkvidd
    Posted 3 years ago #

    I am able to search on all "regular" post fields, but if I set Data Type = Custom field instead, the result always returns no search results.

  5. mfalkvidd
    Posted 3 years ago #

    In my case, the generated query has
    ORDER BY meta2.meta_value
    which needs to be
    ORDER BY meta102.meta_value

    I got it working by changing line 972 of extra_search_fields.php from
    but I am not sure if that is the correct solution.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Custom Fields Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic