Code Snippets

WordPress Snippets

Hooks, filters, and getting out of the theme editor - shortcodes, functions.php snippets, and how to write them without opening a hole.

Filter these 7 posts

Everything in WordPress Snippets

  • Disable the WordPress theme and plugin file editor

    11/16/2014

    Disable the WordPress theme and plugin file editor

    To tighten security of your WordPress site, you can disable users’ ability to edit your theme and plug-in files. After all, isn’t that what your web development team should be doing?

  • CollabPress: project management inside WordPress

    08/06/2014

    CollabPress: project management inside WordPress

    Some people are so enamored with these shiny new project management tools that load so nicely on our smart phones that they forget it should be a transparent part of the project and not a task and part of the process of…

  • Need multiple contact forms on your WordPress website?

    03/16/2014

    Need multiple contact forms on your WordPress website?

    There are plenty of contact form plug-ins for WordPress. I’ve used a few that I thought would be good but turned out to be barely functional, clunky, and/or buggy.

  • A WordPress shortcode that lists posts or pages

    03/08/2014

    A WordPress shortcode that lists posts or pages

    In WordPress, you can do a lot with shortcodes, the problem is, some work fine then one day they just break. It’s best to stick with ones that work reliably, even when you upgrade.

  • Insert PHP Code in WordPress via Shortcode

    02/26/2014

    Including a PHP file from a WordPress shortcode, safely

    The 2014 version of this shortcode takes a file path out of the post and includes it, which is a local file inclusion hole with extra steps. The fix is small: let the code decide which files are includable, not the person writing the post.

  • Turn on WordPress Debugging

    02/26/2014

    Turn on WordPress Debugging

    When you’re in development mode, it’s useful to get errors in scripts as they occur. Just place this line anywhere in your functions.php file for your active child theme and you will start seeing debug feedback complete…

  • Remove the markup WordPress adds after a comment form

    02/25/2014

    Remove the markup WordPress adds after a comment form

    Find the line in your child theme’s “comment.php” file where it calls on the function comment_form() and replace that line with this: