Send an email with PHP – useful for a simple contact form if (isset($_POST[‘submit’])) // Your submit button or a required form field { $EmailTo […]
Rename SQL Table
If you wish to rename a SQL table use the following code: ALTER TABLE table_name RENAME TO new_table_name;
Add an Index to a MySQL Table
An index speeds up the serving of data by allowing you to quickly find data in a table without having to go row by row […]
Split A Large MySQL Table Into Multiple SQL Files
If you have a large database table that is causing your import to fail, you can split the table out into smaller more manageable chunks […]
Copy MYSQL Table Structure and Import Specific Columns
This code will allow you to copy the table structure from an existing table into a new one and then copy data from specific columns […]
Notepad++ Exclude File Types from Find In Files
Use the following filter to disallow certain file types from being searched when searching multiple files: *.* !*.png !*.jpg !*.jpeg !*.webp !*.bmp !*.gif !*.mp4
Add Custom Image & Thumbnail Upload MetaBox To WordPress
This creates a custom metabox for posts and pages and allows us to upload an image. Copy it into your child theme’s functions.php file NOTE: […]
Add A Primary Key To A Table In MYSQL
Run the following code to amend an existing column into a Primary Key ALTER TABLE `wp_posts` ADD PRIMARY KEY (`ID`), MODIFY `ID` bigint(20) UNSIGNED NOT […]
Change Image Filenames In MYSQL (jpg to png)
Create a script (replacing the variables as necessary) and run it to replace ALL instances of (in this case) “star.jpg” to “star.png” <?php // CHANGE […]
Set First Image In WordPress Post As The Featured Image
Add the following code to your functions.php file. To run it, simply visit any page on the site – DO NOT USE THIS CODE ON […]