WordPress plugin – Restrict Post Taxonomies

April 17th, 2014 by Sean Barton No comments »

I have had the need recently to allow users for a site to post. Other than assigning the appropriate role to grant people access to the admin pages I needed contributors to ONLY be able to post to specific categories. I found a plugin called ‘Restrict Author Posting (link)’ in the WordPress plugin directory but it didn’t really do what I wanted. Not only did it contain rather bad English that I would rather site users not see but it … Continue reading


WP Snippet – show only own items in media uploader

April 17th, 2014 by Sean Barton No comments »

I have just put together a quick snippet for you. The media uploader, by default, will show all items uploaded. When running a community site where people can contribute their own media you might not want to give access to every upload. The following code, when added to your theme functions.php file, will  cause the media uploader to only show uploads for the currently logged in user. The code add_filter(‘ajax_query_attachments_args’, ‘sb_my_attachments_only’); function sb_my_attachments_only($query) { if ($user_id = get_current_user_id()) { if … Continue reading


Contact Form 7 – place GET, POST, SERVER, COOKIE, SESSION etc variables into fields

April 16th, 2014 by Sean Barton 4 comments »

As part of a job I am doing to extend a Contact Form 7 implementation and to pay additional homage to the plugin itself I would like to show you how to get PHP environment variables into your fields. Until now I have found myself writing complex and frankly undocumentable (through a combination of lack of time and shame at my hacky approach!) snippets to get custom data into my clients’ contact forms. I had a similar job today whereby … Continue reading


Contact Form 7 – doing *something* when an email has been sent

April 16th, 2014 by Sean Barton No comments »

I love contact form 7, unlike a fair few others who have either purchased Gravity forms or who have gotten stuck using something like CForms which I really don’t get along with. I use it on every site I write and, with the new addition of the Flamingo plugin which, despite it’s infancy, has potential for the future, rarely find anything I can’t do with it. In this case I needed to perform a web service call when an email … Continue reading


WordPress Snippet – Clear Transients

April 14th, 2014 by Sean Barton No comments »

Transients are a wonderful way to temporarily cache pieces of information within WordPress. They are very flexible so you can store objects, strings, JSON.. anything really! They are used commonly in widget plugins whereby content is generated or, more commonly, pulled from a remote API. The reason being because API calls take time and often the data doesn’t change for a while at a time (Tweets for instance.. unless you’re Stephen Fry in which case updating every page refresh might … Continue reading


WooCommerce sites breaking after upgrade to 2.1

March 19th, 2014 by Sean Barton No comments »

WooCommerce, which I am a huge advocate for, has released V2.1 a few weeks ago. Much to the elation of everyone who follows their work too because the way the plugin is progressing is a real positive and invaluable resource for the WordPress community. Sadly for me though every time the phone rings at the moment it’s from a client who uses WooCommerce complaining their site is no longer functioning and is throwing errors all over the place. I have … Continue reading


WooCommerce plugin to create bespoke and customisable landing pages

February 19th, 2014 by Sean Barton 2 comments »

WooCommerce is a wonderful plugin. I often rave about this and use it as often as possible in my projects. It has excellent support for third party plugins and API access. One thing that is a little fiddly at times is support for shortcodes. The WooCommerce shortcode library is rather diverse and pretty well documented but if you aren’t entirely happy creating these beasts or if they need editing frequently the task can be a little mammoth for even the … Continue reading