[wp-hackers] Permalink Performance
Ryan Bilesky
rbilesky at gmail.com
Fri Oct 22 08:38:00 UTC 2010
/blog/%postname% causes verbose page rules, /blog/%year%/%postname% does
not. It appears to be ignoring the static string and just looks at the
first wildcard.
I do believe I found the code responsible for this in
wp-includes/rewrite.php on line 1984.
if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/",
$this->permalink_structure) )
I believe if this code were changed to
if ( preg_match("\A/%(?:postname|category|tag|author)%/",
$this->permalink_structure) )
that should work. Can someone double check my regular expression and make
sure I got this right though.
On Thu, Oct 21, 2010 at 12:39 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:
> I thought that it should still work, thanks for confirming that. I did
> create a tarc ticket http://core.trac.wordpress.org/ticket/15187 because I
> think the issue is probably that wordpress detects if the permalink starts
> with a numeric value (like %year%) and if it does not just assumes to force
> verbose page rules.
> On Thu, Oct 21, 2010 at 12:27 PM, Otto <otto at ottodestruct.com> wrote:
>
>> Looking at the code, I see that I have been mistaken on this point for
>> some time now. Static strings at the front of the permalink string do
>> not disable verbose page rules. Although I don't know why it's doing
>> that, since static strings should be fine to avoid the problem.
>>
>> I'll have to investigate the rewrite system some more.
>>
>> -Otto
>>
>>
>>
>> On Thu, Oct 21, 2010 at 2:16 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:
>> > I made an interesting discovery today, I use a permalink of
>> /blog/%postname%
>> >
>> > Now while having another rewrite rules issue I install this plugin (
>> > http://wordpress.org/extend/plugins/askapaches-rewriterules-viewer/)
>> > according to it, my blog is using verbose page rewrite rules.
>> >
>> > Now performance wise this isn;t much of an issue as I won;t have
>> probabbly
>> > more than 50 pages or so, but this is causing another issue when I
>> modify
>> > the sql queries of one blog to pull posts, pages, and comments from
>> another
>> > blog on my multisite install. see my other recent email about my
>> subdomin
>> > probllems with multisite. I am using the query filter to change
>> wp_#_table
>> > to wp_table and everything works find, except pages, unless I copy the
>> pages
>> > to that sites table to create the rewrite rules.
>> >
>> > Anyway just though I'd update this with my findings about using a static
>> > string to start post permalinks.
>> >
>> > On Thu, Sep 2, 2010 at 10:45 AM, Ryan Bilesky <rbilesky at gmail.com>
>> wrote:
>> >
>> >> According to http://codex.wordpress.org/Using_Permalinks
>> >>
>> >> Permalinks for posts should start with some sort of number.
>> >>
>> >> "For performance reasons, it is *not* a good idea to start your
>> permalink
>> >> structure with the category, tag, author, or postname fields. The
>> reason is
>> >> that these are text fields, and using them at the beginning of your
>> >> permalink structure it takes more time for WordPress to distinguish
>> your
>> >> Post URLs from Page URLs (which always use the text "page slug" as the
>> URL),
>> >> and to compensate, WordPress stores a lot of extra information in its
>> >> database (so much that sites with lots of Pages have experienced
>> >> difficulties). So, it is best to start your permalink structure with a
>> >> numeric field, such as the year or post ID."
>> >>
>> >> Now my question is this, I would like to have my permalinks for posts
>> look
>> >> like this: mysite.tld/blog/%postname%
>> >>
>> >> Does anyone know if this will cause any performance issues since they
>> start
>> >> with a static string?
>> >>
>> > _______________________________________________
>> > 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