[wp-hackers] Performance improvement -- '/%postname%/%post_id%/' over '/%postname%/'?
Nikola Nikolov
nikolov.tmw at gmail.com
Sat Jan 11 19:54:14 UTC 2014
What could possibly be faster though would be to create a custom post type
with it's own custom rewrite rules(in the form of
"/cpt/%cpt_name%/%post_id%/" - you would get slightly longer permalinks,
but it might be worth it. You wouldn't have to pass the post name to the
query, but just the ID. It will also require some extra code - to create
the proper permalinks when they are requested for a post of that post type,
to add in the rewrite rules, etc.
On Sat, Jan 11, 2014 at 9:48 PM, Otto <otto at ottodestruct.com> wrote:
> On Sat, Jan 11, 2014 at 10:44 AM, Aahan Krish <krish+wphackers at aahan.me>
> wrote:
> > Considering that many posts are made each day (upwards 50), which of
> these
> > two permalink structures would suit us best?
> >
> > /%postname%/, e.g. domain.com/sample-post/
> >
> > /%postname%/%post_id%/, e.g. domain.com/sample-post/123/
> >
> > Will the '/%postname%/%post_id%/' permalink structure help as the
> database
> > size grows (i.e. the no. of posts)? or can we simply stick with
> > '/%postname%/' no matter what?
>
> They will be basically identical in terms of performance, for any
> WordPress version. Using either form will trigger the
> "verbose_page_rules" flag.
>
> - This will cause WP versions pre-3.3 to generate individual Page
> rules in the rewrite rules list. This can be a problem if you have
> lots of Pages.
> - This will cause WP versions post-3.3 to generate 1 extra SQL query
> to determine if the URL matches an existing Page in the database.
>
> In either case, the impact of the two different rules is identical. No
> need to tack a post ID on there.
>
> -Otto
> _______________________________________________
> 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