Category: WordPress

Plugin developer, Core contributor and support volunteer. Yeah, I’m a WordPress fan!

  • My recent experience of submitting a WordPress plugin to the directory

    My recent experience of submitting a WordPress plugin to the directory

    It’s been around 3 years since I last submitted a plugin to the WordPress directory. A lot has changed since then and having just had a new one approved, I thought I’d compare the process.

    First of all, let’s talk about that previous plugin, back in 2020. It wasn’t particularly complex, but then neither was my recent one.

    I submitted the code on 9th November. On the 11th November they rejected it due to a failure to use unique prefixes on the function names. I corrected it, sent it back and, same day, it was approved.

    Let’s compare this to my recent submission.

    (more…)
  • Are transients now housekept correctly in WordPress?

    Are transients now housekept correctly in WordPress?

    I’m going to go against Betteridge’s Law of Headlines (sorry, Ian) because, I believe, the answer here is “yes”.

    10 years ago, I was part of a conversation in Trac about WordPress’ housekeeping of transients. It was closed off with a half-hearted attempt to resolve the issue with the reasoning of…

    This leaves much to be desired, but we don’t want a core update to be blamed for breaking a site that incorrectly assumes transients aren’t transient.

    Basically, because some plugins may store data as transients, when they shouldn’t be, they were afraid to housekeep it fully.

    (more…)
  • PHPCS and WordPress: Which sniff to use?

    PHPCS and WordPress: Which sniff to use?

    Which WordPress sniff?

    When using PHPCS for checking WordPress code, there are a number of sniffs/rulesets that you can use…

    1. WordPress-Core. This cover off the WordPress core coding standards
    2. WordPress-Docs. This one checks for WordPress inline documentation standards
    3. WordPress-Extra. This is an extended set of rules with recommended best practices, not sufficiently covered in the WordPress core coding standards. In other words, above and beyond the core standards. This also includes the WordPress-Core standards.
    4. WordPress. This is a complete set with all of the sniffs – the equivalent of WordPress-Extra and WordPress-Docs

    As a developer, I’m not sure why you’d want to use anything other than the whole set, so I’d recommend using the WordPress sniffs.

    Use a VIP sniff?

    If you’re using the set-up that I documented, you’ll also have the VIP sniffs installed as well.

    WordPress VIP are an enterprise-level hosting company, dealing with some of the biggest websites there are. As a result, they have additional requirements around tighert security and better performance.

    • WordPressVIPMinimum – for use with projects on the (older) WordPress.com VIP platform.
    • WordPress-VIP-Go – for use with projects on the (newer) VIP Go platform.

    All customers have been moved off the original WordPress.com platform, so you should only really use WordPress-VIP-Go.

    These rulesets contain only the rules which are considered to be “errors” and “warnings” and use rules from the WordPress Coding Standards (WPCS) project, as well as the VariableAnalysis standard. VIP have certain differences on their platform which may mean that certain things don’t work (e.g. they have a mainly read-only file system), so these sniffs will highlight this and offering up links to documentation and general solutions.

    I would recommend using this sniff along with WordPress.

    How to check which sniffs you have

    On the command line run phpcs -i to view the sniffs that you have installed locally. This is my output…

    The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress-VIP-Go, WordPressVIPMinimum, PHPCompatibility, PHPCompatibilityParagonieRandomCompat, PHPCompatibilityParagonieSodiumCompat, PHPCompatibilityWP, Modernize, NormalizedArrays, Universal, PHPCSUtils, VariableAnalysis, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
  • YouTube Embed: One of the Best WordPress Video Player Plugins to Try in 2023

    YouTube Embed: One of the Best WordPress Video Player Plugins to Try in 2023

    WordPress theme company, Astra, have reviewed video player WordPress plugins and consider my very own YouTube Embed to be one of the best.

    And, to be fair, it was a tough crowd. Whereas YouTube Embed is specifically just for YouTube videos and then only using the capabilities of Google’s own API, the rest of the list were not such constrained, often providing their-own bespoke players for any kind of video.

    Never-the-less to be regarded amongst the others, many of which are commercial offerings, was an honour. Indeed, their favourite was listed at position 1, but they don’t make it clear if their “Top 10” is in order. If it is, my plugin is number 3, which makes even better. And, the top 2 are both commercial, paid-only options. Whatever the case here, they had little negative to say other than the fact that the plugin makes use of shortcodes.

    If you’re looking for a powerful method of embedding your YouTube videos in WordPress, you know where to look!

  • Installing PHPCS on MacOS

    Installing PHPCS on MacOS

    If you’re developing for WordPress then, in my opinion, use of PHPCS to help validate your code is critical.

    However, anyone can develop without necessarily being a whizz with the command line (and I include myself in that bracket). So, having just gone through a PHPCS install with a freshly-baked MacBook, I thought I’d share the process. If only for me the next time I do it.

    (more…)