Top Banner
Lucy Tomas • @_lucymtc • #WCAlicante2017 WORDPRESS MEJORES PRÁCTICAS CO-ORGANIZADORA WORDPRESS VALENCIA Y WORDPRESS DENIA AUTORA PLUGINS EN REPOSITORIO WORDPRESS.ORG LUCY TOMAS, WEB ENGINEER @10UP WORDPRESS ENGINEERING BEST PRACTICES
39

10up WordPress Engineering Best Practices

Apr 15, 2017

Download

Lucy Tomas
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

W O R D P R E S S M E JO R E S P RÁC T IC A S

CO - O R G A N I ZA D O RA W O R D P R E S S VA LE N C I A Y W O R D PR E S S D E N I A

AU T O RA P LUG I N S E N R E P O S I T O R I O W O R D P R E S S . O R G

LUCY T OMA S , W EB E N G IN EER @1 0UP

W O R D PR E SS E N G I N E E R I N G B E S T P RACT I CE S

Page 2: 10up WordPress Engineering Best Practices

Í N D I C E

Sobre 10up

Rendimiento

Seguridad

Librerías y frameworks

Patrones de diseño, documentación y estilo

Algunas buenas prácticas en JavaScript

Page 3: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

S OB R E 1 0 UP

USA Canada Europe India

Page 4: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

S OB R E 1 0 UP

https://10up.github.io/Engineering-Best-Practices

Page 5: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

S OB R E 1 0 UP

Page 6: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

R E N D I M IE N T O

Page 7: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

WP_Object_Cache y Transients API

RE N D I M I E N T O

Page 8: 10up WordPress Engineering Best Practices

RE N D I M I E N T O CAC H E Y T RANS IE NT S

Page 9: 10up WordPress Engineering Best Practices

RE N D I M I E N T O CAC H E Y T RANS IE NT S

Page 10: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

wp_cache_set() / wp_cache_get()

RE N D I M I E N T O CAC H E Y T RANS IE NT S

Page 11: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

RE N D I M I E N T O CAC H E Y T RANS IE NT S

Page 12: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

RE N D I M I E N T O

admin-ajax.php

CAC H E Y T RANS IE NT S

Page 13: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

WP_Query vs. get_posts() vs. query_posts()

RE N D I M I E N T O

hook pre_get_posts

WP _QU ERY

Page 14: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

Argumentos de WP_Query que optimizan la consulta

RE N D I M I E N T O

'no_found_rows' => true ( evita SQL_CALC_FOUND_ROWS )

'update_post_term_cache' => false

'update_post_meta_cache' => false

'fields' => 'ids'

Evitar'posts_per_page' => -1

'post__not_in'

WP _QU ERY

Page 15: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

RE N D I M I E N T O

wp_options autoload

Page 16: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

S E G U R I DA D

Page 17: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

VA L I DA R , S A N EA R , E S C A PAR

SE GUR IDAD

Page 18: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD

VAL IDA R , S AN EAR

VAL IDA R , S ANE AR , E SCAPAR

Page 19: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD

sanitize_* wp_kses_*

sanitize_text_field(), sanitize_key(), sanitize_email(), sanitize_title(), wp_kses,…….

VAL IDA R , S ANE AR , E SCAPAR

Page 20: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

VA L IDA R , ESC APAR

SE GUR IDAD

- Atributos: esc_attr()

- Enlaces: esc_url()

- Traducciones: esc_html_e(), esc_html__() en lugar de _e() y __()

VAL IDA R , S ANE AR , E SCAPAR

Page 21: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD

L AT E ESC AP IN G

EV ITAR

VAL IDA R , S ANE AR , E SCAPAR

Page 22: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD

P R EVE N I R I NY EC C I O NE S S Q LC O N W P D B P R EPAR E

VAL IDA R , S ANE AR , E SCAPAR

Page 23: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD

N ON C EScheck_admin_referer, wp_verify_nonce, wp_nonce_field, wp_create_nonce,…….

Page 24: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD NON CES

Page 25: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

SE GUR IDAD NON CES

Page 26: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

L IB R E R Í A S Y F RA M E W O R K S

Page 27: 10up WordPress Engineering Best Practices

E N W O R D PR E S S

9 9 % D E LO Q U E SE N E C E S I TAM O S

L I B R ER Í AS / FRA M EW OR KS

Y mucho más…

Page 28: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

PAT R O N E S D E D I S E Ñ OD E S I G N PATT E R N S

Page 29: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

E S T I LO Y DO C U M E N TAC I Ó N

Page 30: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA S C R I P T

Page 31: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA SC R I P T

U S O D E J Q U ERY M O D ERA D O

Page 32: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA SC R I P T JQ UERY

V S

Page 33: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA SC R I P T JQ UERY

V S

Page 34: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

EV I TA R H AC E R L A M I S M A S EL EC C I Ó N M Á S D E U N A

V EZ

JAVA SC R I P T

Page 35: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA SC R I P T

V S

Page 36: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA SC R I P T

C LO S U R ESEV I TA C O N TAM I NA R EL O B JE T O W IN D O W L I M I TAN D O E L AL C ANC E D E VAR I AB L ES Y

F UNC I O N ES

Page 37: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

V S

JAVA SC R I P T CLOSU RES

Page 38: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

JAVA SC R I P T CLOSU RES

Page 39: 10up WordPress Engineering Best Practices

Lucy Tomas • @_lucymtc • #WCAlicante2017

G RAC I A S