• Resolved arshadndt

    (@arshadndt)


    Hi,

    I am trying to use the following filter to add extra info the the title in my search results, but it does not seem to be working:

    add_filter( ‘aws_title_search_result’, ‘my_aws_title_search_result’, 10, 3 );

    I am using custom fields and I am trying to concatenate them to the title in search results. Here is my code for getting the custom fields data:

    global $post;
    $text1 = get_post_meta( $post->ID, ‘_tyre_size_field’, true );
    $text2 = get_post_meta( $post->ID, ‘_load_speed_field’, true );
    $text3 = get_post_meta( $post->ID, ‘_tyre_brand_field’, true );
    $text4 = get_post_meta( $post->ID, ‘_brand_model_field’, true );
    $text5 = get_post_meta( $post->ID, ‘_run_flat_field’, true );

    I would like to concatenate my title like so:

    function my_aws_title_search_result( $title, $post_id, $product ) {
    $title = $title . $text1 . text2 . text3 . text4 . text5;
    return $title;
    }

    Please advise how I should go about doing this?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Filtering Title in Search Results’ is closed to new replies.