Remove paragraph tags from images in WordPress
By default, WordPress wraps images in ‘p’ tags. That is annoying. Here’s a nifty trick via jamesc on Stackoverflow for removing it.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?php /* Plugin Name: Image P tag remover Description: Plugin to remove p tags from around images in content outputting, after WP autop filter has added them. (oh the irony) Version: 1.0 Author: Fublo Ltd Author URI: http://fublo.net/ */ function filter_ptags_on_images($content) { // do a regular expression replace... // find all p tags that have just // <p>maybe some white space<img all stuff up to /> then maybe whitespace </p> // replace it with just the image tag... return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); } // we want it to be run after the autop stuff... 10 is default. add_filter('the_content', 'filter_ptags_on_images'); |
Save that to your wp-content/plugins folder and activate it via the dashboard.
Display http in Firefox
Starting with Firefox version 7, the http:// protocol indicator no longer appears in the url by default. This means when you copy and paste the url from the address bar you get, for example, www.domain.com instead of the full http://www.domain.com.

For average users this is no big deal. But if you copy and paste urls into HTML code a lot, like I do, you need to manually enter http:// each time. It’s tedious and annoying, and if you’re copying and pasting dozens or even hundreds of urls for a project it’s easy to miss a few. Then the links don’t work. And that’s even more annoying.
Fortunately there’s a fix for this – which is probably old news by now to some readers, since Firefox 7 was released in September 2011. But it’s still an issue today in version 12. It also bit me sort of hard yesterday when I left the http:// out of a couple of links in an HTML email newsletter that was sent out to over 1,000 subscribers*.
So here’s how to display http:// in Firefox:
Type about:config into the address bar.
![]()
Filter for browser.urlbar.trimURLs,

then double-click it, so it’s value turns to “false”.

And that takes care of that. Now the http:// appears in the address bar, and will be included when you copy and paste the url.

* Regarding the email: I tested it using Outlook 2010, which apparently does not require http:// in the code to recognize urls. So the links appeared to work just fine for me. But the editor of the newsletter uses Outlook 2003, which does require http://. So he noticed the error, but not before the email was sent. Gah!
(Email standards… C’mon! I’m sure I’ll have more to say on that subject in future posts…).

