The Downside of the WordPress Plugin Directory

One of the most powerful and useful parts of WordPress and other popular CMS software offerings is the seemingly endless number of available plugins to extend functionality in nearly any way you like. WordPress provides the Plugin Directory, where developers can publish their open source plugins free of charge for other users to download and use at no cost. In fact, I’ve contributed to the Plugin Directory with a number of offerings over the years, including Document Gallery, Hello Simpsons Chalkboard Gag, and Prezi Embedder. But, with all this power does come a downside…

As a site owner planning to use one of these plugins, you either have to read every line of code from the plugins you are planning to to use (and understand the code enough to spot any possible security vulnerabilities), or you have to trust that the plugin developer has made the code secure. If the developer was careless, your site could quickly be compromised (hacked!).

Continue reading “The Downside of the WordPress Plugin Directory”

Jetpack Sharing Links Revisited

Jetpack for WordPressA few months ago I posted about how to shorten WordPress Jetpack sharing links. Today, I would like to revisit this topic and provide a cleaner solution that I recently uncovered.

Unlike the previous solution I described, this does not require editing the source of the Jetpack plugin, and thus will persist through plugin updates.

In order to implement this quick fix, you will first need to create a functions.php file in your active theme. If you do not have a custom theme, I would strongly suggest using a child theme, as not doing so will mean losing your modifications if a newer version of your theme is released at a later date.

In short, all that you need to do is hook into the built-in filter provided within the Jetpack source. A filter is a little piece of code that plugin authors (and WordPress core authors) can include to allow users control over some inner functionality. In this case, the filter allows us to tweak what the sharing URL displayed to the end user will look like. If you would like a deeper explanation of content filters and their close cousins, action hooks, the WordPress Codex provides an excellent description of both.

In any event, the fix, shown below, simply returns the shortened URL for use in all the sharing links. Give it a try and be sure to comment if you found this useful!

NOTE: If you would like additional control over which social networks receive shortlinks and which receive the full permalink, you can use the $social_network value, which contains a string with the name of the network.