#11870 closed defect (bug) (wontfix)
categories.php does not redirect to front-end.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.9.1 |
Component: | Administration | Keywords: | close |
Focuses: | Cc: |
Description
Hi, This is my first post here, so please go easy on me if I have done something incorrectly...
When I add a link to edit a category from my theme, Wordpress appears to be coded to allow me to redirect back to the page where the link was originally clicked. I believe that the logic in /wp-admin/categories.php is backwards thus always forcing redirect to categories.php.
The following code can be found starting on line 99 of /wp-admin/categories.php:
$location = 'categories.php'; if ( $referer = wp_get_original_referer() ) { if ( false !== strpos($referer, 'categories.php') ) $location = $referer; }
by changing this conditional statement:
if ( false !== strpos($referer, 'categories.php') )
to:
if ( false === strpos($referer, 'categories.php') )
The bug was fixed for me on 2.9.1
Attachments (2)
Change History (11)
#1
follow-up:
↓ 4
@
15 years ago
- Keywords 2nd-opinion added; category redirect removed
- Owner set to dancole
- Status changed from new to assigned
#2
follow-up:
↓ 5
@
15 years ago
- Keywords dev-feedback added; 2nd-opinion removed
The current code restricts redirection to the current admin page. I don't know why that restriction is in place. Perhaps someone has any info on that.
I do know that the proposed solution isn't good:
With the current patch, if you're on wp-admin/categories.php?pagenum=2 and you edit a category, you will loose the ?pagenum=2 part.
#3
follow-up:
↓ 7
@
15 years ago
- Keywords close added; dev-feedback removed
11870b.diff allows redirects to the front-end, but you lose the feedback, i.e. you won't know if the category edit was successful or not.
The only fix for that would be to reintroduce the "Go back" button, so I'm thinking wontfix for this ticket.
PS: You might want to try my Front-end Editor plugin. :)
#4
in reply to:
↑ 1
@
15 years ago
Replying to dancole:
I think your right, but I haven't tested it. It doesn't make sense to allow it to be anything but false with an exact match. Maybe I'm confused.. I'll attach a patch anyway and have someone else confirm this.
Thanks for the attention on this!
#5
in reply to:
↑ 2
@
15 years ago
Replying to scribu:
The current code restricts redirection to the current admin page. I don't know why that restriction is in place. Perhaps someone has any info on that.
I do know that the proposed solution isn't good:
With the current patch, if you're on wp-admin/categories.php?pagenum=2 and you edit a category, you will loose the ?pagenum=2 part.
Ahhh... good catch, My test installation did not have enough categories to test this - sorry for the oversight. I have reproduced this and have worked out another possible solution. I appears that the conditional statement may be able to be reduced. I have tested the following code in all known scenarios with success. It should replace the code I originally posted (Sorry, but I do not know how to make the .diff files yet - if I even have permissions for that kind of thing - new to all this)
if ( $referer = wp_get_original_referer() ) $location = $referer;
#7
in reply to:
↑ 3
@
15 years ago
Replying to scribu:
11870b.diff allows redirects to the front-end, but you lose the feedback, i.e. you won't know if the category edit was successful or not.
This can easily be introduced by customization via theme or plugin. Which IMO would be ok mainly due to the fact that a theme or plugin would need to provided the link to edit the category.
The only fix for that would be to reintroduce the "Go back" button, so I'm thinking wontfix for this ticket.
PS: You might want to try my Front-end Editor plugin. :)
Thanks for the link. I will definitely look into this.
I think your right, but I haven't tested it. It doesn't make sense to allow it to be anything but false with an exact match. Maybe I'm confused.. I'll attach a patch anyway and have someone else confirm this.