[wp-hackers] How to remove /author/ permalink

Nikola Nikolov nikolov.tmw at gmail.com
Wed Mar 12 00:42:24 UTC 2014


The solution can be something like:

1. add a rewrite rule(should be something like "^/([^/])/?" =>
"author=$matches[1]" ) with a high priority(so that it is before the WP
default rewrite rules).
2. Hook on parse_request action hook and see if it's a request for an
author page.
3. Check if author exists - if they do, do nothing. If the don't:
4. Check if verbose_page_rules is
true($wp_rewrite->use_verbose_page_rules). If it is - see if a page with
that slug exists.
5. Otherwise see if the request is for a post and if not, check for a page
with that slug.

You would need to dig into /wp-includes/rewrite.php in order to get a
better understanding of how the WordPress rewrite internals work.


On Wed, Mar 12, 2014 at 2:02 AM, Chris Williams <chris at clwill.com> wrote:

> I was assuming one would:
>
> 1) Build a test copy of the current setup on a local machine
> 2) Change the rewrite rules.
> 3) Write some new test posts to be sure the rules are the way you want
> them.
> 4) Change the existing posts (as I suggested)
> 5) Test to make sure that you can see the old posts (and pages) via the
> new rewrite rules.
> 6) Upload this test system to the live system.
>
> But whatever, throwing your hands up and just forgetting the whole thing,
> as you suggest, is also an option...
>
> On 3/11/14 4:38 PM, "Marko Heijnen" <mailing at markoheijnen.nl> wrote:
>
> >This are rewrite rules and can’t be added in MySQL since they will be
> >regenerated. I would not recommend doing this unless you are knowing what
> >you do. What isn’t the case here.
> >What you need to do is adjusting the rewrite rules for users but you need
> >to do more. You also need to validate that pages (maybe posts too) don’t
> >conflict with those.
> >So what you can do is rewrite those too but without the use case it’s
> >hard to see what the right approach is.
> >
> >Best,
> >Marko
> >
> >
> >Op 12 mrt. 2014, om 00:34 heeft Chris Williams <chris at clwill.com> het
> >volgende geschreven:
> >
> >> Should be able to use a MySQL utility to do some kind of search/replace.
> >> Perhaps export to a .SQL file, use a text editor to remove the desired
> >> text, and reimport it.
> >>
> >> On 3/11/14 9:16 AM, "Sinan" <yok2504 at gmail.com> wrote:
> >>
> >>> Any solution ?
> >>>
> >>>
> >>> 2014-03-06 22:52 GMT+02:00 Sinan <yok2504 at gmail.com>:
> >>>
> >>>> Hello
> >>>>
> >>>> What is the best way to do
> >>>>
> >>>> this
> >>>> *example.com/author/username <http://example.com/author/username>*
> >>>>
> >>>> into this
> >>>> *example.com/username <http://example.com/username>*
> >>>>
> >>>>
> >>>> --
> >>>> Sinan İŞLER
> >>>> sinanisler.com <http://www.sinanisler.com/>
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Sinan İŞLER
> >>> sinanisler.com <http://www.sinanisler.com/>
> >>> _______________________________________________
> >>> wp-hackers mailing list
> >>> wp-hackers at lists.automattic.com
> >>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> >_______________________________________________
> >wp-hackers mailing list
> >wp-hackers at lists.automattic.com
> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list