Category: WordPress Snippets

Enable oEmbed Within Text/HTML Widgets

By default if you paste a link to a YouTube video within a WordPress post, it automatically embeds the video – unfortuneatly if you paste a video URL into a text widget this doesn’t happen. Paste the below into your functions.php file to turn on oEmbed functionality for text/HTML widgets:


Enable Shortcodes in Widgets Without a Plugin

It’s annoying that WordPress doesn’t automatically allow shortcodes in widgets, luckily it only requires a few lines of code to include this functionality. Paste the below into your functions.php file:


Change Default Length of Excerpt in WordPress

I think by default the WordPress excerpt is set to 55 words. With the below snippet you can change the excerpt length to whatever you want, the below limits it to 100 words but you can change the ‘100’ to whatever you like, paste the below into your functions.php file:


Stop WordPress Pinging Itself When you Link Internally

I find it very annoying when I place a link on one post, to another post and then I get a comment notification within the WordPress admin informing me there has been a ping/trackback to one of my posts. With the below snippet you can stop this happening (place in functions.php file):

Limit the Number of Revisions on a WordPress Post to Avoid Bloating the Database

By default WordPress doesn’t limit the number of revisions a post can have, this means if you have a post that you regularly update it can become a database hog. The below snippet limits the amount of revisions to 10, you can change the number ‘10’ to anything you like (place in functions.php file):


Continue reading…