Support » Plugin: KIA Subtitle » How to make subtitle searchable in WP Search Box?

  • I have displayed the subtitles on WooCommerce Product pages. If you enter certain text from the subtitle into the WordPress search box, it doesn’t return the correct results.

    How can I make the Product Subtitle searchable in the search box so that an entered keyword(s) that are present in the subtitles will fetch the relevant products.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author helgatheviking

    (@helgatheviking)

    Hi there,

    You are straying in to custom code territory. You may want to review this thread: https://support.advancedcustomfields.com/forums/topic/adding-custom-fields-search-to-wordpress-search/

    which has some good ideas for searching by meta. However, please know, that searching by a meta field will probably not be performant.

    Good luck!

    Thanks. You have provided a code for adding the subtitle to the Page Title Meta tag.

    What modifications need to be made to the code if the subtitle is to be added to the WooCommmerce Product Title meta tag? Will this make the subtitle searchable? Since the WP search box can search for keywords in the Product title?

    I tried putting your code to the child theme functions.php but it isn’t working. I don’t know if your code also applies to adding subtitle to Product Title meta tag.

    Plugin Author helgatheviking

    (@helgatheviking)

    What code are you referencing? What do you mean by product title meta tag? But the search is querying the database, so modifying the front-end title’s display won’t effect that. You need to modify the search query.

    At https://wordpress.org/plugins/kia-subtitle/ under the FAQ section and the topic “Can I add the subtitle to the Page Title Meta tag”, you provided the following code:

    function kia_add_subtitle_to_wp_title( $title ) {
    if ( is_single() && function_exists(‘get_the_subtitle’)) && $subtitle == get_the_subtitle( get_the_ID() ) ) {
    $title .= $subtitle;
    }
    }
    add_filter(‘wp_title’,’kia_add_subtitle_to_wp_title’);

    Plugin Author helgatheviking

    (@helgatheviking)

    That’s related to the front-end display and has no impact on the search query.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to make subtitle searchable in WP Search Box?’ is closed to new replies.