Support » Plugin: WP Custom Fields Search » not working for custom post type post search

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author don benjamin

    (@dondon-benjamincouk)

    Hi,

    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.

    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

    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.

    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
    $order=$this->joiner->sql_order($order,$this->name,$this->index,$value,$this->comparison);
    to
    $order=$this->joiner->sql_order($order,$this->name,100+$this->index,$value,$this->comparison);
    but I am not sure if that is the correct solution.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘not working for custom post type post search’ is closed to new replies.