Prepared statements

(For WordPress database functions see here) Prepared statements provide strong protection against SQL injection, because parameter values are not embedded directly inside the SQL query string. The server uses these values directly at the point of execution, after the statement template is parsed. ->bind_param() The first argument defines the input data, each character matches it […]

Read More

TEXT or VARCHAR

Which is best? Put simply, use a VARCHAR field instead of TEXT for columns between 255 and 65k characters if possible as it will lead to potentially fewer disk reads and less writes. VARCHAR Max size of 65535 characters Uses 2+n bytes to store the value where n is the length of the stored string. […]

Read More

Lazy loading images

Browers now support the loading= attribute which allows you to specify if images should be lazy loaded: Options: “auto”Default lazy-loading behavior of the browser (same as not including the attribute). “lazy”Defer loading of the resource until it reaches a calculated distance from the viewport. “eager”Load the resource immediately, regardless of where it’s located on the […]

Read More

Category/archive page actions

The archive page is shown when a category is selected and typically has excerpts of each post in that category Category page hook Doesn’t work? Maybe your theme has overridden the default WordPress category pages with its own custom category page? Theme hooks Look in your theme’s archive.php (or category.php) file – does it have […]

Read More

YahnisElsts plugin-update-checker

This updater is great for auto updating of private plugins and also themes. Library links https://github.com/YahnisElsts/plugin-update-checker These notes are based on the excellent guide included on GitHub Should you use GitHub to host your plugin-update-checker releases? plugin-update-checker lets you create a release in GitHub and have that as where your files get hosted, nice and […]

Read More

Day Names

Get # day names from DateTime and into the past Get # day names from DateTime and into the future

Read More