• I found something strange
    I installed a WordPress then from setting . Reading I set a sample page as homepage
    And when I opened website it was ok and showed content of sample page but when I added query string “?name” it showed latest blog posts
    I tried everything as query string nothing did that and all showed sample page content and that was ok
    Just just with ?name query string showed different thing
    For ex localhost/site/?name show latest posts but
    Localhost/site/?everythingyoutype
    Was ok and show content of the page
    Why ?name query string is like that??? I want ti remove it

Viewing 9 replies - 1 through 9 (of 9 total)
  • I cannot reproduce what you describe. I have a WordPress 6.0.1 with TwentyTwentyTwo as theme and no plugins enabled. If I call there then a URL with ?name=example comes a 404 page.

    The parameter name is a protected parameter in WordPress. It is used by WordPress for query vars, see: https://codex.www.ads-software.com/WordPress_Query_Vars

    If you want to customize this (for whatever reason), you could possibly start with this hook: https://developer.www.ads-software.com/reference/hooks/removable_query_args/

    Thread Starter masimoti

    (@masimoti)

    Hi threadi
    actually you must test it just on homepage of your site
    not another pages
    it hurts SEO if you show something else with query string on your site (specially on your homepage) instead of the main content
    basically as you said when you enter the url of homepage with /?name you should see the homepage and nothing should change because it’s just a query string
    I can show you an example
    see this : https://amepro.at/
    as you see everything is fine and homepage of website is ok
    but please see this one https://amepro.at/?name
    here you see the blog posts and it hurts SEO very bad
    I got too much errors on search console with these kind of urls

    Thread Starter masimoti

    (@masimoti)

    I saw all protected query vars
    all of those parameters should remove because this action is not SEO Friendly at all
    you can’t show visitor something on homepage and show something else with query strings like this

    Ah, now I’ve got it. What you describe happens when you add a parameter without a value. So only ?name instead of ?name=example

    I don’t see a connection with SEO. There would have to be links to such URLs so that search engines could find and index them at all. I don’t know any project where this is the case.

    If you intentionally use parameters in the URL, then you should control them exactly – many plugins that do this use their own query vars, of course. And those actually always have a value as well. Not no value as in your example.

    I was wrong with my hook tip above, unfortunately. To clean up the public query vars you could use this filter here:

    function remove_query_vars( $query_vars ) {
        return [];
    }
    add_filter('query_vars', 'remove_query_vars');

    This will display the start page when you call the link you found. However, this could mess up some other things on the system, so I wouldn’t recommend doing this.

    Thread Starter masimoti

    (@masimoti)

    Can you explan the logic behind it why should we show another thing like latest post when someone enter some parameter ?
    it’s not normal at all

    • This reply was modified 2 years, 4 months ago by masimoti.
    Thread Starter masimoti

    (@masimoti)

    I dont wanna use the code you sent because as you said it may cause another problem

    Unfortunately I can’t explain this, I’m not that deep in the wordpress code (yet). Maybe you could open a ticket in Trac so that core-developers could answer this: https://core.trac.www.ads-software.com/newticket

    Thread Starter masimoti

    (@masimoti)

    429 Too Many Requests
    I got this when I wanted to publish a ticket there
    would you please ask them?

    Unfortunately no. Please try again later.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WordPress bug with rewrite rule’ is closed to new replies.