WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Magic Fields] Can't search custom post types created with MF2 (2 posts)

  1. poisonborz
    Member
    Posted 2 years ago #

    I'm just transitioning to 2.0, but I can't seem to get search working
    - nothing shows up in the results. Search works for normal posts and
    any custom post type I create with a different plug-in, but not in
    MF2.
    (and, ahem, of course "exclude from search" is not checked in the post
    type options)

    What could be the problem?
    Thanks

  2. poisonborz
    Member
    Posted 2 years ago #

    I eventually solved this by applying a search filter over the original
    query:

    function searchfilter( $query ) {
    if ( isset( $query['s'] ) ) {
    $query['post_type'] = array('posttype1','posttype1');
    }
    return $query;
    }

    add_filter('request', 'searchfilter', 1);

    I wonder why it won't work without it though...

Topic Closed

This topic has been closed to new replies.

About this Topic