Popular Posts
All posts ordered by popularity
PHP Get Absolute Path, Document Root, Base URL
Depending on your server configuration, getting correct path information can be challenging. For example, PHP does not provide a variable that will return the the base URL of your site. To help out, you can use the following code snippets to get the absolute path, document root, and base URL, respectively.
Redirect HTTP to HTTPS
In addition to www canonicalization, you can also canonicalize the HTTP protocol, redirecting HTTP to HTTPS (or vice versa) using Apache/.htaccess. Below you will find several ways to force SSL/TLS for all URI requests. This is especially useful for sites with existing links pointing to unencrypted http:// URLs. Enforcing use of SSL/HTTPS helps to eliminate […]
Customize WordPress Allowed Tags for Comments
By default, the WordPress comment form enables users to include basic HTML tags in their comments. This includes tags like <p></p>, <br />, <strong></strong>, and so forth. These basic tags suffice to add basic formatting in most cases. But for some setups, more tags may be needed.
Disable caching with .htaccess
Quick .htaccess snippet to disable browser caching by modifying Cache-Control, Pragma, and Expires headers. Strictly plug-n-play.
Replace all instances of a string in WordPress
Here is how to replace all instances of a string in WordPress.
Display category name in WordPress
Here are two snippets for displaying the category name and displaying the category link in WordPress.
Create .htaccess files on OS X and Windows
This is a quick tutorial on how to create .htaccess files on Windows (PC) and OS X (Mac). This post also explains a bit about how .htaccess files work, and how to view them on various operating systems.
Disable caching with HTML
If you can’t use .htaccess to disable caching at the server-level, here is an alternate HTML-only method that disables Cache-Control, Pragma, and Expires headers via <meta /> tags.
Disable external URL requests
During development there may be situations where you want to prevent WordPress from making URL requests to external websites. Here is a simple way to disable external URL requests during development.
WordPress 404 email alerts
Here is a customized plug-n-play PHP script for reporting 404 errors via email. No editing required, just clean email alerts for each 404 error.
Difference between home.php & front-page.php
This article explains the difference between WordPress’ home.php and front-page.php theme templates, as related to the display of your site’s front page. For best results, log in to the Admin Area of your WP installation and follow along with the text.
View all WP query variables
Micro Tip for the day: slice of PHP code for viewing all WordPress query variables. Very useful for figuring out custom loops and such.