https://millionclues.com/wordpress-tips/functions-hooked-to-wordpress-action-filter/
https://millionclues.com/wordpress-tips/functions-hooked-to-wordpress-action-filter/
Various coding collections categorized
https://millionclues.com/wordpress-tips/functions-hooked-to-wordpress-action-filter/
By OutsourcedContent — on June 1, 2020 Add the following code to the functions.php of your active theme. add_filter( ‘woocommerce_marketing_menu_items’, ‘__return_empty_array’ ); This will remove the following Marketing menu added in WooCommerce 4.0
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…
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
By OutsourcedContent — on June 15, 2021 The easiest way to find the Post ID, Page ID or Product ID in WordPress is to hover over the post in WordPress admin and check the link. The number after post= and before & is the post ID. You can also find this in the address bar…
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 =…
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…
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…
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…
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…