LinkedIn emplea cookies para mejorar la funcionalidad y el rendimiento de nuestro sitio web, así como para ofrecer publicidad relevante. Si continúas navegando por ese sitio web, aceptas el uso de cookies. Consulta nuestras Condiciones de uso y nuestra Política de privacidad para más información.
LinkedIn emplea cookies para mejorar la funcionalidad y el rendimiento de nuestro sitio web, así como para ofrecer publicidad relevante. Si continúas navegando por ese sitio web, aceptas el uso de cookies. Consulta nuestra Política de privacidad y nuestras Condiciones de uso para más información.
Redis as a Persistent Object Cache
• WP lets you drop in a custom object cache.
• Redis lets you store things in memory for fast
• Redis offers built in failover features that make it
easier to scale than Memcached
• Page caching is the act of caching entire
rendered HTML pages.
• Pages can be stored in the object cache
avoiding database queries entirely
• All output involving a database read on the front
end should be fragment cached aside from the
main WP query.
• For example, generated HTML from a feature
post carousel should be cached since it uses a
• Remote blocking calls can be a huge
• Cache remote calls as long as possible
• Utilize non-blocking remote requests wherever
Prime Cache Asynchronously
• Don’t make the user wait for a cache to be
• Re-prime after invalidation
• Cleverly prime cached data asynchronously
(cron, non-blocking AJAX, etc.)
• Admin-ajax.php is for admin use only. It is not
cached as aggressively as the front end. Page
caching will not work.
Off the Shelf Caching Plugins
• Can be difﬁcult to install and even more difﬁcult
• Created for the general public and often bloated
• Keep it simple.
Avoid Front End Writes
• Database writes are slow
• Avoid race conditions
• Page caching makes them unreliable.
• If you really need to write data on the front end,
Understand WP_Query Parameters
• 'no_found_rows' => true: Tells WordPress not to pass
SQL_CALC_FOUND_ROWS to the database query.
• 'update_post_meta_cache' => false: useful when
post meta will not be utilized.
• 'update_post_term_cache' => false: useful when
taxonomy terms will not be utilized.
• 'ﬁelds' => 'ids': useful when only the post IDs are
needed (less typical). Avoids lots of extra preparation.
Understand WP Query Parameters
• ‘posts_per_page’ => ‘…’: Sets the query limit to
something other than -1
• ‘post__not_in’: Tells MySQL to run a NOT IN
query which is inherently slow. Try to avoid.
Use a CDN
• CDN’s enable you to serve static assets from
servers closer to your visitors while reducing
load on your web server(s).
• CDN recommendation is very unique to each
Reduce the Number and Size of HTTP
• Minify JS and CSS ﬁles
• Concatenate JS and CSS ﬁles
• Optimize images
• HTTP 2?
M A I N TA I N A B I L I T Y
A N D S TA B I L I T Y
Maintainable Code Improves Stability
• Easily maintainable and extendible code bases
are less susceptible to bugs.
• Bugs in maintainable code are solved quicker
• New features are more easily created in
• Happy engineers are more productive (often
Modern PHP Design Patterns
• WordPress core is backwards compatible with
• Your project does not need to be constrained by
incredibly outdated software
• Namespaces, traits, composer, etc.
Don’t Obsess Over MVC PHP
• MVC (model, view, and controller) is a great
pattern in many situations.
• WordPress is inherently not object oriented. We
ﬁnd that forcing MVC with tools like Twig
ultimately leads to more confusing code that is
harder to maintain.
Modern JS Design Patterns
• Write modular code with tools like Webpack and
• Group distinct pieces of functionality into plugins
as much as possible.
• This separation simpliﬁes deployments and
enables you to reuse functionality on other
• Opt-in to functionality through usage of hooks
• Properly documented code is more quickly ﬁxed and
• Make documentation a part of your code review process
• PHP Documentation Standards:
• JS Documentation Standards:
• WordPress has a very rich, easy to use API with
ways to create posts, send HTTP requests,
create metaboxes, etc.
• Creating wrappers around these core APIs more
often than not just results in a layer of confusing
code and another library to memorize.
• PHPUnit for PHP
• Core unit testing framework and WP Mock -
• Tests improve quality and stability through
identiﬁcation of issues. Decrease regression
• Escape data that is printed to the screen
• Escape data as late as possible
• Check out the esc_* functions in the codex.
Limit Login Attempts
• Limit max number of login attempts to prevent
Require Strong Passwords
• Weak passwords are one of the most common
ways attackers exploit websites.
• Require your users create strong passwords.
There are a few great plugins that do this
Review Every Line of Code
Over 40,000 community plugins
• Plugins reviewed before submission
• Plugin revisions not reviewed
• Review guidelines not geared for high
Review Every Line of Code
Thousands of community themes
• More stringent review guidelines than
• Review guidelines not geared for high trafﬁc
• Performance not measured
Understand Your Librarys
• jQuery, Underscores, etc. are helpful tools but
should not be used blindly. There is no substitute
• Encouraging engineers to understand the
libraries they are using will improve overall code
quality and decrease bugs.
• Keeping track of code history with version
control is critical.
• Mandate workﬂow at the start of project to keep
everyone on the same page.
• Use descriptive commit messages
• Gitﬂow: http://nvie.com/posts/a-successful-git-
Internal Code Reviews
• Code reviews help ensure performance,
security, maintainability, and scalability
• Engineers improve skills by reviewing and
Q U E S T I O N S ?
@ T L O V E T T 1 2
TAY L O R . L O V E T T @ 1 0 U P. C O M
TAY L O R L O V E T T. C O M