Drop this code into your theme’s functions.php file to remove both ‘website’ and ’email’ field from WordPress’ comment form
Snippets
This action will remove WordPress functionality of saving a commenter’s information – name, email, and website – in a cookie on their browser.
This code will return an unordered list of most commented posts in the last 30 days. You can easily customize it as per your preference.
By default when you press the tab key in a textarea, it moves to the next focusable element. Here’s how you can alter this behavior by inserting a tab character instead.
We can use CSS to display the URL of a link after the link. For this we don’t need to modify HTML as all work is done by CSS. This is the complete CSS to do this: a:after{ content: ‘ ‘ attr(href); // Style URL font-style:italic; color:blue; } The CSS […]
A quick bit of code to delete all trackback or pingback comments from WordPress posts. Access database and run this SQL command.
Set of commands to bulk convert default WordPress tables from InnoDB to MyISAM, or MyISAM to InnoDB storage engine via MySQL.
If you are running your WordPress site as a CMS, you may come across need to include pages from your site in the main feed, along with your posts. Well, the below code will give you that ability. function add_pages_to_rss_feed( $args ) { if ( isset( $args[‘feed’] ) && !isset( […]
A list of useful htaccess redirects that you can easily implement on your site. Redirect removed pages Redirect deleted pages back to your site’s home page, or anywhere you want. RedirectMatch 301 /page1/?$ http://mydomain.com/ RedirectMatch 301 /page2/?$ http://mydomain.com/ If all pages share a common pattern, we can rewrite this in […]
The below snippet will allow you to add an attribute to all images embedded in a WordPress post. function sumtips_image_attribute($content) { global $post; $pattern =”/<a(.*?)href=(‘|\”)(.*?).(bmp|gif|jpeg|jpg|png)(‘|\”)(.*?)>/i”; $replacement = ‘<a$1href=$2$3.$4$5 attribute=”attribute_value”‘; $content = preg_replace($pattern, $replacement, $content); return $content; } add_filter(‘the_content’, ‘sumtips_image_attribute’); Replace attribute=”attribute_value” to whatever attribute you need. Example: function sumtips_image_attribute($content) { […]