WordPress.org

Ready to get started?Download WordPress

Forums

WP Custom Fields Search Not searching custom post types (1 post)

  1. pescadito01
    Member
    Posted 1 year ago #

    WP Custom Fields Search is a fantastic plugin, we need to keep it alive!

    but because https://wordpress.org/support/topic/plugin-wp-custom-fields-search-not-searching-custom-post-types?replies=8 was closed,

    i add my quater here:

    for WP Custom Fields Search work with custom post type, you need add this plugins:

    <?php
    /*
    Plugin Name: _my_feed_with_post_types
    Plugin Script: _my_feed_with_post_types.php
    Plugin URI:
    Description:
    Version: 0.1
    Author:
    Author:
    Template by: http://www.ballyhooblog.com/add-custom-post-types-wordpress-main-feed/
    */

    function myfeed_request($qv) {
    if (isset($qv['feed']) && !isset($qv['post_type']))
    $qv['post_type'] = array('post', 'propiedades',); /* put your postypes here */
    return $qv;
    }
    add_filter('request', 'myfeed_request');

    ?>

    <?php
    /*
    Plugin Name: _my_search_post_types
    Plugin Script: _my_search_post_types.php
    Plugin URI:
    Description:
    Version:
    Author:
    Author URI:
    Template by:
    */

    function any_ptype_on_cat($request) {
    if ( isset($request['category_name']) or (isset($request['feed']) && !isset($request['post_type'])) )
    $request['post_type'] = 'any'; /* put your postypes here */
    return $request;
    };
    add_filter('request', 'any_ptype_on_cat');

    ?>
    ----------------------------------------------------------------

Topic Closed

This topic has been closed to new replies.

About this Topic