Opened 4 years ago
Last modified 3 weeks ago
#56312 reopened defect (bug)
Appending ?name to home URL shows the posts page instead of a static front page
| Reported by: | masimoti | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
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 to remove it
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
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
Change History (7)
#1
in reply to: ↑ description
@
4 years ago
- Component General → Query
- Keywords needs-patch needs-unit-tests added
- Milestone Awaiting Review → Future Release
- Summary WordPress bug with rewrite rule → Appending ?name to home URL shows the posts page instead of a static front page
#2
@
4 years ago
Hi @masimoti
Welcome to WordPress Trac! I was also able to reproduce it on a clean install. I will look into it for a possible solution. Not for this only we will have to apply the solution for all reserved words.
#4
@
4 years ago
- Keywords close added; needs-patch needs-unit-tests removed
- Resolution → wontfix
- Status new → closed
- Type defect (bug) → feature request
Why would you like to add "name" as parameter ?
As it is a reserved term it cannot be replaced as explained by @SergeyBiryukov
If this bothers you, you might want to switch to another variable get parameter name.
If it really bothers you, you need to completely rewrite WP Core for your personal use (case), which is absolutely fine, but you will need constant and heavy patching for new security and feature updates. I would not recommend you doing the latter as ( if you succeed ) will probably end you with an outdated and modified version of WP Core.
So .. my 2 cents .. go with option one.
#5
@
4 years ago
- Keywords needs-patch added; close removed
- Resolution wontfix
- Status closed → reopened
- Type feature request → defect (bug)
This sounds like an issue we should be able to fix. I was able to reproduce it on a clean install
Reopening this as there's still some discussion that can be had. It seems reasonable to display the preferred front page experience (blog posts or static front page) when an invalid name parameter is provided.
#6
@
4 years ago
That is absolutely fine.
I would still argue that this is (however reproducable) not an issue that needs our (highest) attention.
This ticket was mentioned in PR #13213 on WordPress/wordpress-develop by @samuelhadsall.
3 weeks ago
#7
- Keywords has-patch has-unit-tests added; needs-patch removed
An empty name query variable prevents WP_Query from converting the
main query into the configured static front-page query. As a result,
/?name displays the posts page instead of the static front page.
This change ignores name when its value is an empty string, matching
the existing handling for an empty pagename query variable. Non-empty
post-name queries remain unchanged.
A regression test has been added for the empty name query variable.
Trac ticket: https://core.trac.wordpress.org/ticket/56312
## Testing
npm run test:php -- --filter test_page_on_front_with_empty_name_query_varnpm run test:php -- --group query- 1,894 tests and 4,426 assertions passed
git diff --check
## Use of AI Tools
AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5 (Codex)
Used for: Local environment troubleshooting, tracing the relevant query
handling, proposing the regression test, and reviewing the resulting
changes. I manually applied and reviewed the changes and ran the relevant
test suite.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi there, welcome to WordPress Trac! Thanks for the ticket.
Replying to masimoti:
I suspect this is because
nameis one of the reserved terms in WordPress, which specifically refers to a post slug, and since a post with an empty slug cannot be found, the query defaults to the posts page.This sounds like an issue we should be able to fix. I was able to reproduce it on a clean install:
?nameparameter to the URL.