Category: Development

  • Preventing Self Pings

    Preventing Self Pings

    If you have pingbacks switched on for your WordPress site (Settings -> Discussion and then tick ‘Allow link notifications from other blogs (pingbacks and trackbacks) on new articles’) then one annoyance is ‘self pings’ when you link to one of your posts from another.

    Well, self pings can be prevented with a simple script, added to your functions.php file.

    <?php
    function no_self_pings( $links ) {
    foreach ( $links as $loop => $link ) {
    if ( 0 === strpos( $link, get_option( 'home' ) ) ) { unset( $links[ $loop ] ); }
    }
    }
    add_action( 'pre_ping', 'no_self_pings' );
    ?>
    view raw functions.php hosted with ❤ by GitHub
    (more…)
  • How NOT to push out code updates for a WordPress plugin

    How NOT to push out code updates for a WordPress plugin

    https://twitter.com/DavidArtiss/status/825320954221969413

    This is how this started off.

    (more…)
  • Add a Time to Read To Your WordPress Posts

    Add a Time to Read To Your WordPress Posts

    Popular on posts these days is a ‘time to read’ appearing at the top to give readers an idea how long it will take to read through a potential opus. Plugins exist to do this but, when it’s so easy to do, why do it?

    (more…)
  • Why many websites don’t have security as a priority

    Why many websites don’t have security as a priority

    As part of my new job online security is paramount. To this end, for a number of months I’ve been ploughing through my online accounts and updating passwords to be unique and strong. A password manager is essential to this – I use LastPass but 1Password is also recommended. I also changed my email address recently too so I’ve been taking the opportunity to update that as well.

    Unfortunately, some websites, and retailers in particular, don’t seem to want to help out, making it difficult, one way or another, to be as secure online as you’d like.

    (more…)
  • Useful WordPress code snippets

    Useful WordPress code snippets

    If you wish to add any additional code to a WordPress site, where you place it is important. If it’s theme specific code you should add it to `functions.php`, in the theme folder. For CSS you should add this to the theme customizer. If the latter is not available to you, your theme may have a `custom.css` file for this.  If it’s not a theme specific change then I create my own, single-file plugin.

    A lot of my code snippets over the years have gone on to become full-blown plugins in their own right but there is still some code that remains in my site plugin. So I thought I’d share them.

    (more…)