Tag: php

  • PHPCS Anywhere!

    PHPCS Anywhere!

    Something that I do often is run PHPCS on code I’m working on, almost always inside a git repository. Even more likely is that PHPCS was installed via composer, which means it will live in $GIT_ROOT/vendor/bin. So I always end up doing something like ../../../vendor/bin/phpcs file.php which is hugely annoying. Which is why I made…

  • Silly Ideas: Cache WordPress Excerpts

    Silly Ideas: Cache WordPress Excerpts

    Let’s explore dumb ideas around caching parts of WordPress we shouldn’t.

  • WordPress Performance: Caching Navigation Menus

    WordPress Performance: Caching Navigation Menus

    Accelerate your WordPress site by caching wp_nav_menu().

  • Stopping WordPress User Registration Spam

    Stopping WordPress User Registration Spam

    Combatting the surge of user registration spam on WordPress, this guide introduces a code snippet to block registrations from specific email hostnames, offering an extra layer of protection against unwanted sign-ups.

  • Gathering database performance with WP-CLI

    Gathering database performance with WP-CLI

    Discover how we employed WP-CLI to streamline the assessment of database server performance in WordPress, facilitating a more efficient profiling of SQL queries before and after crucial server upgrades.

  • Fixing a broken ATOM Feed

    Fixing a broken ATOM Feed

    The article explains how to convert an outdated ATOM feed to a JSON feed using a PHP proxy script. It details the process of fetching, caching, and transforming the XML data into a JSON format that can be used for more modern feed readers. The provided code snippets illustrate the conversion steps from ATOM to…

  • Converting CSV to SQL

    Converting CSV to SQL

    Learn how to convert CSV files into SQL statements using PHP. Avoid directly inserting data into a live database; follow a safer approach. See a PHP script example for converting CSV files into SQL inserts, with an output demonstration for an “airtravel.csv” sample. Use this script cautiously or as a starting point for similar tasks.