-
Hello everyone at RankMath Support
Recently, I had experiencing an issue with the aforementioned ‘Custom query parameter not defined in target URL’ on one of my websites. This happens after I had submitted new Sitemaps and requested for Google Indexing.
The website in the question: https://thepremierresidence.com/
-
To clarifying further, I am still relatively new to WordPress and this Website-building. I am not too bad when making or some changes that are ‘visible’ on the site/editor, it is all with the codes that pretty much kills me.
For example, I had read another Threads of same issue, and there been suggest of adding specific filter, so this are my main question; Where do I have to put in, on WordPress? I am seeing both “Appearance”, and “Divi”, and not sure which one I should go to…
Follow this one; https://wpml.org/forums/topic/adding-query-string-parameters-with-wpml-issues/ , and & It appears to be fixed.
Not sure where, or what, error codes are, though
Nope, scratches that – It looks ‘Fixes’ because Google showed the result of ‘base’ language, which is English, and not the ones from problematics languages that are affected.
It also mean that method, I would have to redirecting all existing URLS to matching the one that changes as a result
*sigh*
I tried like this, still not works…
add_filter( ‘rank_math/json_ld/search_url’, function( $url ) {
if ( ‘th’ === ICL_LANGUAGE_CODE ) {
return ‘https://thepremierresidence.com/?s=search_term_string&lang=th’;
}
if ( ‘zh-hans’ === ICL_LANGUAGE_CODE ) {
return ‘”https://thepremierresidence.com/?s=search_term_string&lang=zh-hans’;
}
return $url;
} );Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.
Could you please try this filter?
add_filter( 'rank_math/json_ld/search_url', function( $url ) { if ( 'zh-hans' === ICL_LANGUAGE_CODE ) { return 'https://thepremierresidence.com/?s={search_term_string}'; } if ( 'th' === ICL_LANGUAGE_CODE ) { return 'https://thepremierresidence.com/?s={search_term_string}'; } return $url; } );
And here’s a link to how to use a filter on your site:
https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-phpI hope that helps.
Thank you.
The WMPL did works, to an extend. It still detect error ‘Syntax error in Sitelinks Searchbox’, in this “https://thepremierresidence.com/?s=search_term_string&lang=zh-hans, thus showing up with
‘Not all markup is eligible for rich results’
Best regards
Update: Succeed in reducing 2 errors, to just one error
Apparently, the coding have to be exact (blankets and all that) as in the screenshot
Still show error in this part, though:
type
SearchAction

target
Custom query parameter not defined in target URL
type
EntryPoint
urlTemplate
https://helitonrealestate.com/?s=search_term_string&lang=th
query-input
valueRequired
true
type
PropertyValueSpecification
valueName
search_term_stringFounding out the cause : – That part came from <!– /SEO by Squirrly SEO – WordPress SEO Plugin –>
Hello, thanks you for respond.
I tried the method you provided (different website, but pretty same issue/structured(
https://helitonrealestate.com/?lang=th
https://helitonrealestate.com/?lang=zh-hansThe Rich Result testing still detecting 2 errors, 1 in this
Custom query parameter not defined in target URL
https://helitonrealestate.com/?s=search_term_string&lang=thAnd for another one
Custom query parameter not defined in target URL
https://helitonrealestate.com/?s=%7Bsearch_term_string%7D&lang=thProbalbly the same for zh-hans
(The Premier Residence website, I already changes URLS as according to WMPL threads, and it Sitelinks searchbox has started/is in Validation process)
PS note: And are the aforementioned codes are suppose to showing on the top of every pages in WordPress?
I am putting the code as is this;
add_filter( ‘rank_math/json_ld/search_url’, function( $url ) {
if ( ‘zh-hans’ === ICL_LANGUAGE_CODE ) {
return ‘https://helitonrealestate.com/?s={search_term_string}’;
}
if ( ‘th’ === ICL_LANGUAGE_CODE ) {
return ‘https://helitonrealestate.com/?s={search_term_string}’;
}
return $url;
} );Disable the Squirrly SEO, and it is solved.
Summary
Apparently, solution goes as following;
Rank Math -> Added codes correctly + disable other SEO plug-ins (if any)
= https://helitonrealestate.com/?s={search_term_string}WPML method = Squirrly SEO
Different languages in directories -> https://thepremierresidence.com/th/Which would not solve this ‘
https://thepremierresidence.com/?s=search_term_string&lang=th’, which might never be solve, as the URL now are totally difference. Thus, to make the Rich Result Test eligible, may need to deactiave Rank Math plug-in this case.Thank you guys, at last I found what I think to be the solution to this case.
………..No, it works for https://helitonrealestate.com/
But when I tries for https://thepremierresidence.com/, with same things and stufss, it does not work for me….
Let’s see, for Chinese it shown up as : https://thepremierresidence.com/?s=%7Bsearch_term_string%7D&lang=zh-hans
And for Thai: https://thepremierresidence.com/?s=%7Bsearch_term_string%7D&lang=th
Hello,
Sorry for the delay and any inconvenience that might have been caused due to that.
We might need to take a closer look at the settings of your other website. Please edit the first post on this ticket and include your WordPress logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
Hello, Jaideep Asrani
It is actually solved now, though I had to restored the Premier website database from the backup I made before, then re-apply the code from @Reinelle, and it works perfectly. Both websites (Premier and Heliton) are now pending in validation process in Google Search Console.
Thanks for the concern, regardless.
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.
The ticket ‘Custom query parameter not defined in target URL.’ is closed to new replies.