Change Default “Enter Title Here” Placeholder Text In Post Screen

Change Default “Enter Title Here” Placeholder Text In Post Screen

By default WordPress displays “Enter title here” placeholder text in the post title field section on the post screen, where you create a new post. But in case of custom post type, while we register our custom post type, there is no parameter or option to change this default placeholder text to provide more personalized…

.htaccess For WordPress In A Folder Without URL Change

.htaccess For WordPress In A Folder Without URL Change

By OutsourcedContent — on June 3, 2021 For quick reference. Remember to change my_subdir and example.com <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/my_subdir/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /my_subdir/$1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteRule ^(/)?$ my_subdir/index.php [L] </IfModule> Reference: Giving WordPress Its Own Directory

Convert WordPress Image Filename To Lowercase

Convert WordPress Image Filename To Lowercase

By OutsourcedContent — on June 29, 2021 WordPress by default will preserve capitalisation in filename for images. To make filenames lowercase automatically, add the following to the functions.php of your active theme. /** * Convert filename to lowercase * * @author Arun Basil Lal * @refer https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_handle_upload_prefilter */ function prefix_convert_filename_to_lowercase( $file ) { $image_extensions =…

Log WordPress Database Queries To File

Log WordPress Database Queries To File

By OutsourcedContent — on August 2, 2021 Useful to see what changes are made in the WordPress database by a plugin, theme or other code. /** * Log database queries to the /wp-content/sql.log file. * * @link https://wordpress.stackexchange.com/a/144353/90061 */ add_filter( ‘query’, function( $query ){ // Filter out everything that shouldn’t be logged. if…

How to Check if The Current User is The Post Author in WordPress

How to Check if The Current User is The Post Author in WordPress

While working on a WooCommerce project recently, my client asked me if there is a way to show a message to seller on their own product items. A simple message like “you are the seller of this item” if the product page is previewed by the seller itself. Typically WooCommerce is a plugin which essentially…

Prevent User Registration in WordPress From Specific Domain

Prevent User Registration in WordPress From Specific Domain

Usually it’s a good idea to disable user registration in WordPress, if you do not use membership feature, since spammers can attack your website with spam user registrations. One of my clients had enabled the option “anyone can register” in WordPress settings and allowed visitors to register. Within as week, he received couple of user…

How to Disable Emojicons Feature Introduced in New Wordpress 4.2

How to Disable Emojicons Feature Introduced in New Wordpress 4.2

With the release of new WordPress 4.2 version, WordPress team introduced the use of Emojicons in your posts and comments. In order to make this new Emojicons feature to work, WordPress automatically adds JavaScript libraries in your page. Although it’s a nice feature to have for some bloggers who use Emojicons very frequently, but for…