Search_term_string

#83685
  • Resolved Alex
    Rank Math pro

    Hello Guys,
    i am using WPML to translate from EN to AR (Arabic), i am seeing this error on google search console (Sitelinks searchbox Custom query parameter not defined in target URL), (i have placed a screen shot on sensitive data for bot languages)

    i have searched in your blog and didnt found a fix for it, dont know if its a schema issue or its a translation issue.

    i hope you can help me with it
    have a great day today
    all the best

    • This topic was modified 3 years, 7 months ago by Alex.
Viewing 15 replies - 1 through 15 (of 17 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    It seems translating your page also encodes the curly brackets which are usually added to your homepage from s={search_term_string} to s=%7Bsearch_term_string%7D. Please get in touch with the translation plugin team to see if the can exclude the search term string from being encoded while translating.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Alex
    Rank Math pro

    Hi Michael,
    thank you so much for reply,
    is there a way to fix it myself, the plugin came with the theme, and cant contact the translation plugin, dont have account there, its incloded at the theme,

    please tell me if you know a way, i will start googling about it 🙂

    Big thanks again

    Alex
    Rank Math pro

    isn’t this schema added by RM ?
    if you please tell me where its locate so i can see the admin translation of the plugin

    all the best 🙂

    Alex
    Rank Math pro

    Hello Again guys,
    if i only can get your string of that schema?
    for example (rank_math_internal_links_processed)

    i can fix that from the admin translation of the WPML plugin
    thank you so much

    Hello,

    You can use the following filter to customize the Search URL for Sitelinks Searchbox

    
    /**
     * Allows filtering of the search URL.
     *
     * @param string $search_url The search URL for this site with a <code>{search_term_string}</code> variable.
     */
    add_filter( 'rank_math/json_ld/search_url',  function( $url ) {
        return $url;
    });
    

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Alex
    Rank Math pro

    Hello Michael,
    thank you for reply,

    but am not a tec guy and i’d really appropriate it, if you give me more details about how to use this,
    shall i just place it at the them functions.php ?

    all the best and thank you so much 🙂

    Hello,

    Rank Math adds the Sitelinks search box only to the homepage. We are aware some SEO plugins add it to the entire website but that is not the correct way to do it.

    It only needs to be present on the homepage as per Google:
    https://developers.google.com/search/docs/data-types/sitelinks-searchbox#guidelines

    Screenshot: https://i.rankmath.com/Un6GF3

    P.S: The screenshots you added do not exist any longer.

    Alex
    Rank Math pro

    Hi Uzair,

    the issue is that the WPML encode this tring s={search_term_string} at Arabiv version to be like this s=%7Bsearch_term_string%7D.

    and its only at home page,
    my quastion for Michael that is how to fix that issue, or where RM named that string so i can translate it mnauly from the admin transtaion at WPML.

    both screenshots are showing that google has no issue with EN pages but the issue only shows at Arabic site version.

    Thank you

    Alex
    Rank Math pro

    Hello Again Nice people,
    i have made a temporary fix, by installing Real time find and replace plugin and replace the translated string with the proper one,

    but still really apricate it, if you can give me a better solution, or tell me where is RM store that schema sting, so I can translate it my self through WPML

    cant wait for the PRO version guys, that’s they only way where i can participate in the RM empire 🙂

    All the best and thank you again 🙂

    Hello,

    We do not store the Sielink search value anywhere in the Database. It is dynamically added to the frontend. The only way to change it is by using the filter code which my colleague provided before.

    Here is an example on how to change the search_url on different languages:

    
    add_filter( 'rank_math/json_ld/search_url',  function( $url ) {
        if ( 'ar' === ICL_LANGUAGE_CODE ) {
            return 'https://your_site_url.com/?s={search_term_string}';
        }
        return $url;
    } );
    

    I hope that helps.

    Alex
    Rank Math pro

    Hi Patrik and thank you so much for you detailed and easy fix 🙂

    i just made this edit, i have added this *&lang=ar* to the end of the return .
    as this is how it shows right now with the search and reply fix
    do you think that’s correct ?

    
    add_filter( 'rank_math/json_ld/search_url',  function( $url ) {
        if ( 'ar' === ICL_LANGUAGE_CODE ) {
            return 'https://your_site_url.com/?s={search_term_string}&lang=ar';
        }
        return $url;
    } );
    

    thank you so much guys

    Hello,

    Your site appears to be fine now. I checked your site, both translations, with Google Rich Results test tool: https://search.google.com/test/rich-results and the error is gone. You can also test to confirm the same.

    Do you wish to close this thread?

    Please do not hesitate to let us know if you need our assistance with anything else.

    Alex
    Rank Math pro

    Hi Michael,
    i am still using the plugin Find and replace, that’s, why the issue is fixed.

    i just want to confirm if i can add this *&lang=ar* to the end of the return string ?

    All the best man 🙂

    Hello,

    The language definition(*&lang=ar*) is already being added to your translated URL so I don’t believe there is need to add it again.
    img

    If there is any specific reason you wish to add this please let us know.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Alex
    Rank Math pro

    Hi Michael,

    its not me who added that extra &lang=ar, my current fix is Real time find and replace plugin, and i have just replaced the wrong encoded string, please check this screen shot of the plugin and the result https://ibb.co/SBN2xft

    when your friend gives me the add filter code to fix, the last &lang=ar, disappear, and thats why i am asking if i should add it to the end of the filter string.

    All the best Man

Viewing 15 replies - 1 through 15 (of 17 total)

You must be logged in to reply to this ticket.