 All right, it looks like it's got the following stuff, so we can get going. Before I start in, can I get just a quick show of hands? How many of you in the audience live yourselves in your resume or we're talking clients as a developer versus some other job type? All right, so we're about 50-50 split. Okay, so just so you know, Lucy, you didn't raise your hand. It's okay. You don't have to leave. It's no problem. This is geared to be a beginner level developer talk, so there's going to be stuff for those of you who are experts at WordPress, there's going to be stuff for those of you who are relatively new to the ecosystem. No problem there. There is going to be a lot on-screen, and this is going to be unlike most stocks in that the reason there's a link on every single slide is that use the slides to reference. There's a lot of information here, and a lot of it's going to be really useful to reference in the future. I'm not going to read over everything. I'm going to skip over some things, but the slides are going to do the long-line utility. All right, so you can get started. If my ticker will work. How long can I do this? So I'm very chubby. I'm a developer at Bytes Co. Bytes Co. is a early-to-month-based digital marketing agency. We also have offices in Portland, Maine. We have around 350 clients now. We host and develop large-scale enterprise working on solutions for it. I'm somewhat known to WordPress community online, and Americans at WPTab are a couple of days ago. Yeah, it's fun. And with Bytes Co., we went through all that stuff. So I want to start off with what not to do. Now, there are occasional situations for any of the examples that I give. They're valid and reasonable, but when structuring a WordPress site, these are the things that I have run into with clients a bunch of times, where we had to undo a lot of the work, review things, fix things, to get them back to honestly starting point. One of the easiest ones is figuring out what should be a post site. So WordPress is added for a collection of objects. One of the primary ones is the post site. The post is a page, a property, a client, a company, depending on what you want to store and what you want to look for. In general, you want these to be an absolute base level of use. So there are situations where you might want two post sites, one for sole properties and one for available properties if you're a real estate developer. But in almost every case, you're going to want properties and you're going to want an option to choose whether they are sold or available or possibly leased. Because you can think in the future that there are other options that are going to be added. And if you're having a post site to everyone, you're complicating things. Same goes for taxonomies. Those are groupings. If you're trying to make everything a category, like these folks who visit a theoretical duplicate of a site that I swear I saw a few weeks ago, where if you go to their post archive, you would see team members. You would see services and you would see locations on one big archive to all of them together. Because they didn't build separate categories and post types of whole things and separated them out into one single category. Huge blocks of short codes are HTML in your content. Watch out for it. This partially goes for page builders that are based in short codes. But watch what you're making users type and what you're making users deal with. Someone who's a content editor, even if you're super savvy before addressing HTML, probably isn't. And editing this is very much counter to the whole idea that we're addressing this. We're almost through this one. This one is controversial. A lot of people use this to break effect on especially low by the size of short timelines. The template hierarchy in Wordpress allows you to put pages in a theme that are defined by the IE of the relevant post or the slug of the relevant post or category in this case, or taxonomy term. Both of those things can be changed somewhat transparent by the user without them knowing that those will be tied to the contents of the page. So if you migrate hosts, if you have a custom template here for a page I-19 being a content page, that will go away. So if you move to another host, you get different IDs assigned when you transfer your database or your post exported code. And your users have no idea what's happening. Getting back to that is very complicated. Your slug, you can change that. And when you change this as a text box, nobody knows that that's going to change the theme. Use page templates, use meta-fields and options and taxonomy to look through all of those in detail in a minute, but just to not rely on works of the structure of the system to be features for your users. And widgets. This is an actual client-side of ours that came to us many, many years ago for adults. That's their widget-area section. And with it, it scrolls onwards. That is not the end of it. That's not even a third. They had a million sections. They threw on widget logic. And they needed a million different sidebars and a million different sections. In general, I'm a fan of controlling your data. Where it's built. So if it controls page, I'm a fan of that. We're relying on widgets. Home page widgets. Now it's a gray area. People do that. You've got a couple of page sections in your site or different widgets in different sections. They're getting down to a per-page basis. You're doing way, way too much work and people are shelf-controlled around you so much. And custom user interfaces. These aren't bad. Not individually. These are actually very useful things. They control what your client puts where. They let them know what to do in terms of use. But when they get out of hand, when they get out of hand, this is client-guards that want a very strict design control in every single site. So you can see there's 5,000 color swatch options in the jump loader options. The spots where they come to a right show you all the different sections. They have to spend several days training people for this site. And it's not even a system. It's not something intuitive. It's not something they can manage on their own. And the biggest benefit WordPress can offer to users and to clients is easy trainability, easy usability, and a familiar interface. So more you strain, it works. It doesn't mean you shouldn't strain. Custom metafields, custom metaboxes, taxonomies, those are all things that aren't in WordPress 4 and are great for watching. This one happens a lot. People install Biddy. They leave all the options enabled. They say, here's your site, guys, if you want to build a new page, just go for it. Most people creating content do not know the difference between good design and bad design. That's why in pretty much any business you walk into, you will see a flyer for a company softball team or a big sale or something or other in the back room that has competition all over it. And you do not. Everyone will get a gift in your life. Don't let the website become that. So you do want to put some of the control on content. Here's the design options. If they're choosing everything from font to color to size to alignment, the person who you hire to write a lot of posts is not necessarily the person you're able to control your brand. This is more of a warning thing. If you gave your site to Guy Fiery, what would happen? Keep in mind, this is his favorite shirts. A couple good examples. One of these is not fine clients and I'm guessing you can figure out which. This is what happens when you let somebody say, wouldn't it be cool if we throw everything they can on the page? You guys have sets of templates that give some specific options. They can string them together in any order they want to, but they have specific brand book requirements and they have specific brand book options. And by keeping them somewhat limited in design, we keep them on-brand while remaining fresh from page to page. If you want to check out the page, that one's that side. If you're going to go to thingscars.com, if you really like that design, it's kind of realist, it's kind of trendy. Go for it. I figured you're not in countries so I can get away with showing it. So how to do it right. And this is how to do it not necessarily right for a small brochure site. This is how to do it for a large site. It's going to have hundreds of pages. It's going to have text on it so you're going to search and filter. I'm going to go through the different data structures one by one. I'm not going to touch on comments and the reason I'm not going to touch on comments is mostly because there is exactly one custom situation where I've seen repurposing comments go well and that's reviews. Almost every other situation where I've seen people attempt to modify comments to do something else, they have done something in general. Comments work really well as comments on posts. They work reasonably well as reviews on posts. Kind of like me. We're also going to touch on links which are archaic, dead and you will probably never see but they're interesting. Almost everything is a post. Your posts are posts. Your pages are posts. Your menu items are posts. Your attachments are posts. You are dealing with posts a lot more pressing your face whether or not you know it. When you're thinking about what's a custom thing when you're adding it's most likely a post. They are individual items that are defining collections by other types of collections. They and themselves are not a collection. They are a base thing. They are a staff member. They are a location. They are a product. Their own posts are taxonomies of your meta fields in order to those much more later. The big downside to our cross-searching, cross-filtering using things other ways later to a post is that the main content that posts the body of the blog content, page of content, etc. is most often stored in a single blog dictionary. It's good to work against some structure added into that as they are seen in our started where you can separate up blogs so you can parse the location you feel for them but to my sequel to queries that's still an undifferentiated blog it's still unknown. So it's a little bit of a long lesson. So you want to figure out how much of your posts needs to be content and how much it needs to be structured data. So, and that's the counter. The nice thing is you get a creative base for a title, offer, all together you get single posts to get our posts almost five. We're not thinking about going through all of these check out the slides for it but a couple of good things on there. The events calendar, if you are doing events do not try to roll around events system. That way in life's madness there is so much to events in terms of just just ordering them by date and having multiple per day and building the templates necessary for them to let someone else do that job. Relevancy for search results does an excellent job of stripping things like formatting tags out of WP content and allowing you to add all of your things into your searches to make searching through posts very effective. And if you're worried about using any sort of service that counts your number of pages and charges you by it like I heard someone mention yesterday or if you're worried about your SEO attached to a post site pass an archive, you've seen it as linked to the page to this image as the media library that is mostly unwanted unless you are in a very specific situation where you want people commenting on specific images creating specific images or doing tasks like downloading and purchasing them it's probably a good idea to disable it because it ends up often being an unstyled kind of I'm not going to use that one. It becomes unwanted and it becomes something that people aren't attentive to in terms of design or SEO. Users. Unless you need authentication unless you need people to log in and do stuff as a person don't make me use it. Users have permissions whether or not they are signed permissions because plugins are not always necessarily great about getting them permissions and limiting their permissions so it is a very good idea to keep in mind that every user-based stuff you add is a potential risk to your site so users can create content and they can upload images very notably with 497s fix the things that users can do are useful and if you need commenting and self-identicated if you need forums then users' vital needs are impressive. You need people to go in and be able to post content as editors users. If you don't need authentication, don't make me use it. The problem along the floor members, employees, customers. Interesting factoid there are two rules here administrator and editor. One thing that a lot of people believe are at the cuff is that the administrator has completely controlled the site and the editor has only the power to upload both of those can load unfiltered html onto the site and because of that the editor user if they are a malicious actor can get administrative permissions they are someone who can add JavaScript onto a page in your site that when the administrator logs in will make the editor administrative so trust your editors if you give some of the editor privilege or if you give some of the unfiltered html privilege be very, very careful. You just get these very nice profile images from gravitar that's built in functionality it's very nice because it's automatically automatic. A lot of people don't actually know what gravitar is or how to use it so unless you want to explain to all of your users there's also some great plugins to add profile picture functionality where they can upload an image. Once again you can use the template image be careful about security be really careful about your plugins if you're adding users and if you're letting public people log in you are open a door and a lot of plugins out there do not properly close it. Tips, once again go through the slides there's a lot of links in there this one I was really thinking I was going to cut thinking I was going to leave I think it's access managers it does hurt your performance and it is something that does a lot with permissions and as such you have to trust it very explicitly to be safe but it is extremely handy in building heavy workflows deciding who can save a post who can edit a post who can change things you know that keep my log in just like a month ago started selling a pro version that breaks up a lot of their great features with a little package that costs more so it's not that hard to build your own but it is still the best one out there for teaming your login and integration to the site talk about the avatar and this is interesting if you want to have a profile page for your users you don't care if they publish you don't want to show a blog you just want to have a profile page keep in mind the author template which is a default template for showing a user profile is an archive so it pulls in all the posts where we're not so if you're really worried about database performance on a big site build a custom template use custom kernel structure so that you don't have that query going on because if you don't need it it's just nice we're going to touch on this just for a second where press use has a lot of roles a lot of roles are cold you can show your favorite sites and people on lists you can categorize them that went away two major revisions ago and by and large if you need to show favorite links if you're interested in just categorizing a list of things you find along the web turn it back on it's just disabled there is a really simple one-liner or a feature plugin which is going to show that it's really out of date that shows how many people use the links functionality but simple one-liner to re-enable it and if all you need is just a list of favorites don't bother using posts or using a larger game structure because that's really lightweight it doesn't look too great on the back end it is a kind of WordPress 2.0 it's got XFN data don't know if anybody's had that unless we use it so terms we're almost through we're on 4 out of 10 so terms are the third basic object type inside users and posts links and that is deprecated they are how you organize together posts put them in groups find them later show them all together they catch a count of the number of things they're stored in any term turns your group into taxonomies if you want to think about it easily it's categories if you are categorizing something the problem is that you've already got categories to eat something else if you want colors to be you can just follow the category you've already got the category terms are a height of impact so blue would be a term in the colors category administrator would be a term in the job title category they are not optimized for being created on single posts in multiple times so if you need to grab like all the terms where they do something get two times on one post page it's going to be a little slow post times better when you save and update terms they update a count on every single term that you have changed or touched since last time you saved if you have 20,000 terms in taxonomy if you change one of those on a post then you update accounts for the number of posts in 20,000 terms that can be incredibly slow so if you are building a large site if you do not need to count those you can turn it off entirely with a do you prefer a term counting function you can turn that off you can turn it off and then turn it back on at the end of a script so if you have to update 50 terms 50 taxonomies turn it off, do an update turn it back on again and it will recount once if you don't do that every time you update your terms it recounts over and over and over and over we have a client who sells long-tranquil posts they have 200,000 products with all their variations and such if they change a category if you visit one of the nightnares they can save and wait 20 minutes defer term counting makes that a lot faster still not super fast better than that um terms are also objects terms can be attached not just to posts they can be attached to any object so you can attach them to users there's no user interface for it but you can do it and it's kind of cool you can categorize your users you can categorize your posts you can technically categorize your terms that way lights don't add terms to terms please edit it so metadata is a key value store attached to every post that lets you drop anything you want into the post so you can say my metadata is the main and my value is great shopping his value is john and his value is c you can store data structures like classes and arrays and you can store moving values like shooting falls it becomes very useful for flagging numeric values which makes it easy to do searches where you want to find someone who's older than 35 in your data structure which all comes in very handy they're associated posts you can also associate metadata with terms you can also associate metadata with users you can normally hear about it on posts but there's no particular reason you can't store a text area of rich text format with your taxonomy terms the color blue have a nice pretty page that describes the color blue before it shows in the article hopefully you can describe the color blue but there's a lot of posts that WordPress builds and automatically the one I want to call attention to is feature image the feature image on every post which is a default option but on most post sites it's going to be there is pulled in from posts and the reason that matters is the post meta provides cache for the fastest operation post meta equaling your first metadata value for a post all of the metadata for that post is cached in memory for WordPress for that problem so that's a great way to make sure that you don't have to go back to database and make additional queries just to get first name, last name and job type feature image is almost always called an archive page where 20 posts or 30, 40, 100 normally not a problem but if you are someone who likes to store a large amount of data in post meta if you want to have the archives of every test you have ever run on the emissions of a vehicle in your post meta for a single post you may have megabytes of data that gets pulled from the database so every single post on your archive page on every single page level it's not that fast and the interesting thing about this there's not a standardized way to disable that cache when I use this call so really the important thing is to keep your metadata slim make sure you don't throw huge amounts of unnecessary data into post meta to your meta or user meta because when you're showing archives to run into problems and then you start storing huge amounts of data we have a client who does art licensing this client has 27,000 pieces of art in their database and at one point they had a big serialized blog of all the information about the art that was maybe maybe $200k for post meta and anytime you view an archive page you'll notice your view of that and store only the data you need so other things are fast it's also important to note that so that you can store numbers, strings, arrays really it's anything you want in post meta WordPress runs these functions maybe serialized and maybe not serialized these are the things in my existence they are the functions that keep me up at night worrying because they use a function called is serialized and is serialized is phenomenal in that it doesn't check if strings actually serialize data it runs a few regular expressions on it and says good enough and as such you can end up in situations where if you save something in post meta and get it back you might not get back what you saved so it's really important to be careful with what you save if you're saving something that is a serialized string or it looks like a serialized string the default recommendation for a lot of people is just to encode it with like basic store encoding or similar that's not a great answer because you can't search for that you can't sort it simple data structures, thin layers try not to store massive amounts of stuff in your post meta oh, talk about that this is an interesting one on your post meta edit screen WordPress by default has locks custom fields and it is a really easy interface to add your own post meta or room post meta it runs a query that shows all the fields that are on any posts so that you can easily see what you've used before and fill all the stuff next to it seems good enough but it tries to hide anything that begins with an underscore so that it doesn't show any of your hidden meta fields a query for a not like on an unindexed table for meta data is incredibly slow for a large table this same client that had a lot of meta data ended up having their edit page before optimization take a couple of minutes to load because it had to run a query to get every piece of meta data to figure out whether the name started with an underscore and if it didn't even though it was a disabled feature the hidden page still runs so there's the filter there we can put it here functions if you are never going to use the custom fields locks you've got a big site do it you've got a small site it won't worry about it but if you're talking about thousands of posts it will speed up your this one is going to be extremely contentious I am not a fan of ACF and I haven't used ACF for years probably hates me for saying that but I am of the opinion that for the same reason that naming templates with dash 19 to target post 19 or to name templates dash cheese to target the post named cheese it is a matter of going to do that because the user knows how to control it it's also a good idea to have a user interface that sets the slope to your posts meta and you're going to call that and use it in templates without the user's control people may not care about that it may be functional but from a best practice case carbon fields allows you to find all of that in code now to ACS credit you can import the structure of your posts meta from a json file it's useful, still pulls to the main base you can still edit it on the back end without some modifications still not a huge fan but I can be argued about that afterwards and then the super weird one beware we need saving functions that work press influence for my sql the escape sql and prepare functions that work press influence occasionally with oddly specific lists of percentages and slashes in your posts meta will not return the same value that you saved in if you saved in slash slash percent percent percent etc and it happens to match up with one of the filler delineators that work press puts in the string it will get lost so you have to be very careful about that options tables for larger sites I honestly recommend not storing all that much in options the customizer stores everything in options widgets store everything in options and your admin panel stores everything in options for larger more custom sites if you're worried about performance a lot of that stuff can be hard coded and doesn't need to be chosen where it does need to be chosen if it's not related to a single post it goes in options if it's related to a single post it goes in post meta it also has the same issue with serialized maybe serialized maybe non-serialized so your data goes in maybe not be the same as comes out be careful about how complex the data is also serialized it in the array if you put an array into the database then you try to store that it will serialize it with PTP serialized and if you try to edit that as a string it will break if you do that with a widget area it will break your site so do not try to do a fine replace on your entire database to change one line of text to another like a site you are use instead if you put a page plugin or WTCLI those are great tools it will do it take care of it and then take care of your serialized data make sure your site does not break page builders so I mentioned earlier how post data is normally stored in an undifferentiated blog most page builders add into that now that doesn't mean there is not a great use for it page builders can be very useful for styling content making pages look unique and individual pages if you are trying to store structured data or information that really matters inside a page builder you are going to have trouble referencing other places calling it out in the query so you have to be extremely cautious when using a page builder it's like how much of your site you want that page builder to control just throwing Diffie on designing all the pages to get you in trouble this is a search result from visual composer interested to know if none of these search results have a word column in the page at all but it shows them search results because they use the short code column and the short code column is searched this is Gutenberg I love Gutenberg, I think that it's going to be a great thing I went to a talk yesterday about how to use it in a very chumped, very detailed manner it was wonderful but one thing to be cautious of your Gutenberg comments is to have a word column or like image end up in search results because you just search the most contents and those columns are part of that relevancy can help you with that building a search cache custom can help you with that third party search plugins can but default request search is going to get interested this talk yesterday if you weren't here go back in time go to this talk just look at the work in Boston it's in there this was fantastic Gutenberg Gutenberg itself is not going to structure your data show you how to tag things change the tags on them but fantastic talk from yesterday about how to do so I'm not going to try and do it bi-directional relationships this is a many to many relationship one thing WordPress cannot do and that means related posts a really kind of hacky and WordPress they're attached to one single post but you don't see so if my post about my dog is related to some of the cat my post about my cat is not related to my post about some of the dog so there are plugins to do this there aren't any good ones there's the idea of storing it one way which is what most related post plugins and things do the idea of storing two different meta values one on each post which is what the sound systems do and it doesn't work all that well because they get out of sync and you have one of the things that's on the other end of the list first you need a many, many big structure where you can store data that shows up on both sides of the movie and the actor you can store additional meta on in the real world actors that have roles attached to movies attached to actors that have roles where all other employees work in offices they have a role at that office to start taking that date they might change policy framework tries it, tool sets tries it they do okay they store meta in both directions they store a verification table that tries to match them to make sure they don't break it still breaks post to actor doesn't okay if you can relate they don't give you any meta post to post is pretty good use the relationship, use the meta but also have them updated in three years it probably won't break the loop because it uses pretty little reach to your own JavaScript I'm working on one, it will be out in a couple months it's not out now, but you can check out the back end of code and use it for super advanced stuff if you're interested, or just follow me on Twitter I've got some tables so sometimes the WordPress data structure isn't enough specific to the searches very often you need to use a black data structure not a traditional data structure to get fast searches so in this space we have products, we want filters we want to be able to count, we want to be able to enable these filters and disable them as they're products under the bottom row it'd be really slow to do relational queries for this with terms and post meta and posts so we have a table that has every single option available for every single product and one single flat table with just a moving value, what do they have to run on you can do searches on that be really fast as great, you can fly it out you can have your posts ID you can go back and you can show the posts that are relevant if you're not relevant problem is if that data gets out of date it no longer matches up with the posts and your filters don't work so you've got to be really careful about rebuilding that patch meaning to external data stores another answer to the same thing about search and filtering is to use an external data store that is not mySQL mySQL is not great at that kind of query so you can use a six search is great at that kind of query you can plug it in with a plug called lasso press it works really well you can use redis for caching objects plug it in to WordPress it works really well good idea that maybe serialized maybe uncerealized it really throws you for a larger amount of trouble with it I've got some functions linked there that basically duplicate the original meta and options functions that have that problem only without the serialized bit you just send them strings there's always a string you're good and the escaping functions can cause problems your data is not there I wish I had a magic bullet for that I wish I could include a snippet for that that is an outstanding issue it's something that if any of you developers have spare time and are interested in working on it do it, improve it, make it better best thing about WordPress is we can do that that's the best, she's my part-time dog so I'm probably about two minutes for questions but I'll also be at the happiness bar after any additional questions anybody? can everyone hate me over?