Mostly Harmless.

  • How to protect your WordPress site from problematic code in the_content

    By default, WordPress lets you write basically anything in the content of a page, post, or custom post type. When you write or see the_content like this in a WordPress template: That’s likely allowing any code through. Even content that could be problematic. Problematic code would include raw iframes and JavaScript scripts. For example, let’s…

    Categories: ,
  • WordCamp Montclair 2020 Promo Videos

    For those that aren’t aware, I am lead organizer of WordCamp Montclair 2020, which is happening May 30-31st. This past Friday myself and 2 other organizers (Eileen and Howard) went to our venue at Montclair State University to shoot some short promo videos. This was Eileen’s idea, and I thought it was a really great…

    Categories: , ,
  • Top 10 Tech Talks

    So far in 2020 I’ve submitted talks to two WordCamps that are happening in the next few months. The talk I submitted is similar to the one I gave at WordCamp NYC in 2019, but with the plan to tighten it up a bit and expand on just one of the topics that I feel…

    Categories:
  • TIL: comma-separated terms

    A good friend of mine emailed me today with a WordPress question: we have a url like /category/term1/ that we’re using to filter on stuff If I do get_query_var(‘category’) it will properly return ‘term1’ If we have the url like /category/term1+term2/ get_query_var(‘category’) still only returns ‘term1’… do you have any insight as to why? Thanks…

    Categories: ,
  • How to create unique widget areas for individual posts in WordPress

    Here’s a cool little trick for adding widget areas that are unique to posts, but without cluttering up Appearance->Widgets in the admin. Instead, we utilize the Customizer, which is perfect for this sort of thing. First thing, we need to hook a function into `init` where we register our widget area.

    Categories: ,