Next Generation WordPress

6ea15b18e25b00e1af953e489439d540?s=47 Ryan McCue
February 07, 2017

Next Generation WordPress

Explore what we need to push into the next generation of the WordPress project.

6ea15b18e25b00e1af953e489439d540?s=128

Ryan McCue

February 07, 2017
Tweet

Transcript

  1. Next Generation WordPress Ryan McCue
 Director of Engineering at Human

    Made
  2. Next Generation Previous Current

  3. None
  4. 2003
 1.x

  5. 2003
 1.x 2005
 2.x

  6. 2003
 1.x 2005
 2.x 2010 3.x

  7. 2003
 1.x 2005
 2.x 2010 3.x 2014 4.x

  8. Blogging CMS Platform 2003
 1.x 2005
 2.x 2010 3.x 2014

    4.x
  9. 4.7 + 4.8

  10. 4.x

  11. Platform?

  12. Platform = Next Generation

  13. 1. Philosophy 2. Process 3. Projects Next Generation

  14. Philosophy

  15. Backwards compatibility Design for the majority Decisions, not options

  16. The user comes first

  17. The user comes first

  18. User Experience

  19. Developer User Experience

  20. DUX

  21. Developers Are Users Too Philosophy:

  22. WordPress Sucks Spoiler:

  23. None
  24. None
  25. Why?

  26. WordPress End-users

  27. WordPress End-users Developers

  28. “What got us here, won’t get us there” — Matt

    Mullenweg, State of the Word 2016
  29. All About Me

  30. Process

  31. How WordPress Works

  32. Incremental development
 =
 Organic growth

  33. “A rolling codebase gathers technical debt” — Ancient Australian proverb

  34. Posts ➡ Pages ➡ CPTs

  35. for end users for developers

  36. Grand Design ≠ better

  37. ~ 2 years pass ~

  38. Design For Developers Process:

  39. Rebuilding the Plane While Flying It

  40. WordPress WordPress

  41. Blog CMS Platform WordPress Architecture

  42. Platform Blog CMS Next Generation

  43. 1. Write wrappers 2. Test both old and new 3.

    Flip the wrapper
  44. Retains Backwards Compatibility Write, Test, Flip

  45. Projects

  46. Set a Standard Projects:

  47. wp_insert_post

  48. wp_insert_post (Why?)

  49. 1. Write wp_insert_post WP_Post::create $wpdb->insert( "INSERT INTO $wpdb->posts" ) wp_set_post_categories()

    wp_set_post_tags() wp_slash()
  50. 2. Test wp_insert_post WP_Post::create $wpdb->insert( "INSERT INTO $wpdb->posts" ) exercise

    left to reader wp_set_post_categories() wp_set_post_tags() wp_slash()
  51. 3. Flip WP_Post::create $wpdb->insert( "INSERT INTO $wpdb->posts" ) wp_set_post_categories() wp_set_post_tags()

    wp_slash() wp_insert_post
  52. 3. Flip WP_Post::create $wpdb->insert( "INSERT INTO $wpdb->posts" ) wp_set_post_categories() wp_set_post_tags()

    wp_slash() wp_insert_post
  53. WP_Post::create

  54. WP_Post::create WP_Page Woo_Product WP_Revision Jetpack_Comic

  55. Rewrites

  56. <?php add_rewrite_rule( 'archives/date/([0-9]{4})/([0-9]{1,2})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]' );

  57. Routers $app = new \Slim\App; $app->get('/hello/{name}', function (Request $request, Response

    $response) { Slim Framework Route::get('user/{id}', function ($id) { Laravel Symfony class BlogController extends Controller { /** * @Route("/blog", name="blog_list") */ public function listAction() {
  58. 'index.php?rest_route=/$matches[1]' ); add_action( 'init', function () { global $wp; $wp->add_query_var(

    'rest_route' ); }); add_action( 'parse_request', function () { global $wp; if ( empty( $wp->query_vars['rest_route'] ) ) { return; } // Finally, do something. }); add_rewrite_rule( '^wp-json/(.*)?',
  59. function () { // Much easier. } ); add_rewrite_rule( '^wp-json/(.*)?',

  60. 'index.php?year=$matches[1]&monthnum=$matches[2]' ); add_rewrite_rule( 'archives/date/([0-9]{4})/([0-9]{1,2})/?$',

  61. function ( $matches ) { global $wp_query; $args = [

    'year' => $matches[1], 'monthnum' => $matches[2], ]; $wp_query = new WP_Query( $matches ); } ); add_rewrite_rule( 'archives/date/([0-9]{4})/([0-9]{1,2})/?$',
  62. add_rewrite_rule( 'login/?$', function () { get_header(); wp_login_form(); get_footer(); } );

  63. 1. Write wrappers 2. Test both old and new 3.

    Flip the wrapper
  64. Bonus:
 No More Flushing

  65. Autoloading

  66. Drupal ✓ Joomla ✓ MediaWiki ✓ Magento ✓ WordPress ✗

    Autoloading?
  67. Autoloading
 is a trade-off

  68. 15 MB 15,000,000 bytes

  69. Autoloading Load Everything

  70. Composer?

  71. Plugin Dependencies

  72. <?php /** * Plugin Name: Amazing Plugin * Requires: other-plugin,

    rest-api */ add_plugin_dependencies( __FILE__, [ 'other-plugin', 'rest-api' ] );
  73. Conflicts? Plugin Dependencies

  74. Already a Problem Plugin Dependencies

  75. Even bigger?

  76. Split WordPress

  77. None
  78. None
  79. None
  80. None
  81. What is WordPress?

  82. Do Not Break WordPress

  83. Next Generation

  84. 1. Philosophy 2. Process 3. Projects Next Generation

  85. Developers Are Users Too Philosophy:

  86. Design For Developers Process:

  87. Set the Standard Projects:

  88. Thanks. rmccue.io speakerdeck.com/rmccue core.trac.wordpress.org/ticket/31245 Frank the DUX Duck
 from Twemoji

    State of the Word photo: Brian Richards for Post Status hmn.md