You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/best-practices-asset-management.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# WordPress Frontend Dependency Best Practices
1
+
# WordPress Asset Management Best Practices
2
2
3
3
#### Break `wp_register_script()` and `wp_register_style()` arguments onto their own lines
4
4
@@ -22,7 +22,7 @@ When registering CSS or JS within a PHP class, always store the asset handle as
22
22
23
23
#### Leverage dependency chaining and the `array()` method for `wp_enqueue_*()`
24
24
25
-
A common place that can feel repetitive is registering and initializing enqueued assets. Make sure you make good, appropriate forcing order and perhaps enqueue of dependencies via `wp_register_*`'s `$dependency` parameter.
25
+
A common place that can feel repetitive is registering and initializing enqueued assets. Perhaps trigger enqueue of dependencies via `wp_register_*`'s `$dependency` parameter.
26
26
27
27
Also, if enqueueing multiple scripts or styles simultaneously, use a single `wp_enqueue_script()` or `wp_enqueue_style()` with an array of dependency slugs to avoid repetition.
28
28
@@ -51,5 +51,5 @@ WordPress does little to prevent the collision of scripts. Short of defining dep
51
51
52
52
Plus at time of writing it's 2017 and React and Vue-based apps, use of JavaScript tools is becoming more prevalent. Some of these authors create a rollup file of dependencies and a rollup of their app. Even in an environment you control, you likely rely on some 3rd party plugins that load dependencies.
53
53
54
-
### Provide a version string for caching
55
-
We recommend tying product assets the version for the Theme or Plugin you're in. Having a condition that checks for local environments (i.e. check request string for ".test") and toggling between a production version and a rand(0,PHP_INT_MAX) is another good option.
54
+
####Provide a version string for caching
55
+
We recommend tying product assets the version for the Theme or Plugin you're in. Having a condition that checks for local environments (i.e. check request string for ".test") and toggling between a production version and a `rand(0,PHP_INT_MAX)` is another good option.
# Great Enterprise-Grade WordPress & Web Development Resources
3
+
###Great Enterprise-Grade WordPress & Web Development Resources
4
4
5
5
*[WordPress The Right Way](https://www.wptherightway.org/en/getting_started/) - [PDF](https://www.gitbook.com/download/pdf/book/tomjn/wordpress-the-right-way?lang=en)
*[GenerateWP.com](https://generatewp.com) -- Interactive tools for creating Core API queries and WordPress File Headers
9
+
*[Design Patterns for Humans](https://github.com/kamranahmedse/design-patterns-for-humans)
10
10
11
-
* 10Up Engineering Standards & Best Practices(forked XWP copy of standards)
12
-
* WordPress.com VIP "What We Look For"
13
-
* Locutus.io/php -- Common PHP methods ported to JavaScript.
14
-
* YouMightNotNeedjQuery.com -- An explainer on using native JavaScript alternatives to jQuery.
11
+
*[10Up Engineering Standards & Best Practices](https://10up.github.io/Engineering-Best-Practices/)[(forked XWP copy of standards)](https://xwp.github.io/engineering-best-practices/)
12
+
*[WordPress.com VIP "What We Look For"](https://vip.wordpress.com/documentation/code-review-what-we-look-for/)
13
+
*[Locutus.io/php](https://locutus.io/php) -- Common PHP methods ported to JavaScript.
14
+
*[YouMightNotNeedjQuery.com](http://youmightnotneedjquery.com) -- An explainer on using native JavaScript alternatives to jQuery.
# On Leveraging Stack Overflow, The WordPress Codex and Search-Sourced Solutions
40
+
###On Leveraging Stack Overflow, The WordPress Codex and Search-Sourced Solutions
42
41
43
42
Stack Overflow, The Codex and Solutions found on blogs are often excellent starting points to learn and develop solutions. However, many solutions aren't written to consider enterprise needs, high-traffic sites or large-scale environments.
44
43
@@ -50,23 +49,10 @@ When integrating someone else's solution, please consider the following:
50
49
* Is this functionality "right-sized?" Perhaps break large procedural functions into helpers.
51
50
* Does the author properly sanitize and validate user input while late-escaping output?
52
51
53
-
# Helpful Utility/Development Plugins
52
+
###Helpful Utility/Development Plugins
54
53
*[FakerPress](https://wordpress.org/plugins/fakerpress/) - Generate Fake WordPress Data (optionally use 500px for real, varied featured post images)
55
54
*[Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) - Regenerate Thumbnails after
56
55
changing Thumbnail Sizes
57
56
*[P3 Plugin Profiler](https://wordpress.org/plugins/p3-profiler/) - Tool to better understand plugin performance
58
57
*[Locomotive](https://github.com/reaktivstudios/locomotive) - Simple, repeatable batch process tasks for wordpress
59
-
60
-
# Helpful Open-Source Resources for Enterprise-Ready WordPress Code
61
-
(not all code available in these organizations is "enterprise ready for everyone", however, there are many good examples for many kinds of enterprises)
Copy file name to clipboardExpand all lines: docs/security.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# On WordPress Security
2
2
3
+
### THIS PAGE NEEDS FORMATTING AND COMPLETION, PRs welcome!
4
+
3
5
* Using Nonces
4
6
5
7
The primary security mechanism in WordPress is nonces. Nonces are time-stamped and tap into the logged-in user cookie. All nonces in the WordPress Admin leveraging the REST API should use the `wp_rest` action ( `wp_create_nonce('wp_rest')` ) and be passed via either the `_wpnonce` data param (GET or POST) or the `X-WP-Nonce` header.
0 commit comments