Make WordPress Core

Opened 8 days ago

Last modified 5 days ago

#50490 new defect (bug)

WordPress URL guessing cannot be stopped

Reported by: devrekli Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4.2
Component: Permalinks Keywords: reporter-feedback
Focuses: Cc:


Hello. https://wordpress.org/support/topic/how-can-i-remove-redirect/


https://www.ozgurbilgi.net/etiketler/aysegul-tecimer (There is no such link in the site.)

to https://www.ozgurbilgi.net/aysegul-tecimer-ustsuz-danscilar

I tried this

function remove_redirect_guess_404_permalink( $redirect_url ) {
    if ( is_404() && !isset($_GET['p']) )
        return false;
    return $redirect_url;
add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );

I tried this

DELETE FROM <code>wp_postmeta</code> WHERE <code>meta_key</code> = '_wp_old_slug'

my htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I tried this

remove_action('template_redirect', 'wp_old_slug_redirect');
remove_filter('template_redirect', 'redirect_canonical');  
remove_action( 'post_updated',      'wp_check_for_changed_slugs',

I searched for it in the database but I couldn’t find it. I do not understand how it redirect.. I tried all this but these did not solve the problem. How can I stop this redirect? thanks

others examples

https://www.ozgurbilgi.net/etiketler/aysun-kayaci to ------> https://www.ozgurbilgi.net/aysun-kayaci-fatih-optu

https://www.ozgurbilgi.net/etiketler/seo to -----> https://www.ozgurbilgi.net/icerik-pazarlamasinda-basarisiz-olmanizin-onemli-nedenleri

I can stop guessing for the normal link but if it gets the prefix (etiketler like this) , the guessing cannot be stopped.

Change History (9)

#1 @devrekli
8 days ago

important: I can stop guessing for the normal link but if it gets the prefix (etiketler like this) , the guessing cannot be stopped.

#2 @SergeyBiryukov
8 days ago

  • Keywords reporter-feedback added

Hi there, welcome to WordPress Trac! Thanks for the report.

I tried this

Any of those options should have worked under normal circumstances. Does the issue still happen with all plugins disabled and a default theme (Twenty Twenty) activated?

WordPress 5.5 will offer better fine-grained control of redirect_guess_404_permalink(), see #16557 for more details.

#3 @devrekli
8 days ago


I have tried it now. The problem continues.

this time, link redirects to a similar picture. these should go to the 404 page.

If there are normal links, these options work. If it gets the prefix, these options don't work.


Last edited 8 days ago by devrekli (previous) (diff)

#5 @apedog
8 days ago

I've had a similar issue when debugging 404/redirects on my local machine. I think 404 headers get cached and refresh doesn't help.

The gist of it was if at any point while testing, I made the url to return a 404 - the browser would keep treating the url as a 404 - even if I changed it later. The 404 header is cached (i think) and the browser does not attempt a reload.

Opening the browser's devtools and setting 'disable cache' will force new headers on every refresh.

#6 @devrekli
7 days ago


you can help me? please thanks

#7 @SergeyBiryukov
7 days ago

Please note that this Trac is used for enhancements and bug reporting for the WordPress core software, not for individual support questions.

Please continue with your topic on the support forums to get help with your site.

this time, link redirects to a similar picture. these should go to the 404 page.

If you have an image with a slug of seo uploaded to a post with a slug of etiketler, then /etiketler/seo/ is the expected permalink of that image (as seen in the video), I don't see a bug here.

If there is still a bug, then some clear steps to reproduce it on a clean install would be helpful.

#8 @devrekli
7 days ago


I think this is a bug. Because There is no link on the site named "etiketler".... The word "etiketler" doesn't matter here. It can be any other word.

That is not the permalink for "seo".

right permalink in the example https://www.ozgurbilgi.net/icerik-pazarlamasinda-basarisiz-olmanizin-onemli-nedenleri/seo

Last edited 5 days ago by devrekli (previous) (diff)

#9 @devrekli
5 days ago

It makes this redirect always. Other examples. I'm using nonsense words


I can remove guess redirects for normal link. if it gets the prefix, what we do is not working.

these links should be 404. thanks

Note: See TracTickets for help on using tickets.