Changes between Version 2 and Version 3 of Ticket #36292, comment 4
- Timestamp:
- 03/22/2016 01:53:38 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36292, comment 4
v2 v3 64 64 This is quite an edge case, most of the rules won't require all this code. 65 65 66 Maybe, internally the function can be used to generate a route class, but to require a class for each custom rule is far from ideal as a public API.66 Maybe, internally the rule callback can be used to generate instances of a route class, but to require user to write a class for each custom rule is far from ideal as a public API. 67 67 68 Regarding skipping the main query, if the callback would return anything that is not an array, then there 's no variableto assign to the main query, so you can just skip the main query if the callback return anything but an array.68 Regarding skipping the main query, if the callback would return anything that is not an array, then there are no variables to assign to the main query, so you can just skip the main query if the callback return anything but an array. 69 69 70 Or maybe, would be possible to just `add_filter( 'skip_main_query', '__return_ false' )` inside the callback.70 Or maybe, would be possible to just `add_filter( 'skip_main_query', '__return_true' )` inside the callback. 71 71 72 72 Also note that this approach easily allows for things like: … … 103 103 And the two systems could live side-by-side without any issue I think. 104 104 105 As a final thought, my Cortex (https://github.com/Brain-WP/Cortex) uses the library FastRoute (by Nikita Popov, one of the PHP devs who contributed more to PHP 7) that is faster and less resources consuming of the WP system because it use a very clever approach described in this blog article http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html105 As a final thought, my Cortex (https://github.com/Brain-WP/Cortex) uses the library FastRoute (by Nikita Popov, one of the PHP devs who contributed more to PHP 7) that is faster and less resources consuming of the WP system because it use a very clever approach described in this blog article http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html 106 106 107 107 I think would be interesting explore the same concept for WordPress.