This was tricky and took me several attempts to figure out how to gracefully remove posts in a specified category from the public BuddyPress Activity Stream. Proposed solutions took the approach of stopping the activity from being added to the table; however, this raised issues when an existing post was updated and put in the excluded category, and also when an excluded post was updated to no longer be in the excluded category. Additionally, these posts were not included in the author’s individual Activity Stream, which led to further confusion.
I had to move `bp_blogs_record_post` from `save_post` to `wp_insert_post` to allow `_save_post_hook` to clean the post cache prior to running `in_category()`.
Continue reading Remove posts with category (or categories) from BuddyPress Activity Stream
I figured this was more useful as a plugin than as a gist. [BuddyPress Sitewide Notice Widget](http://wordpress.org/extend/plugins/buddypress-sitewide-notice-widget/) is available from the WordPress Plugin Directory.
Curly quotes are a particular nuisance, especially in incoming posts. This function removes them before the post (or comment) is inserted in the database. If an older post containing curly quotes is edited, it will save with straight quotes upon database insert.
Continue reading Remove curly quotes on save
In the default state, `wp_nav_menu()` classes for `li` elements are useful as CSS and JS selectors, but are not human-friendly. I prefer to use selectors like `.menu-item-archives` instead of `.menu-item-38008`. This function creates a human-readable class on the `li` elements generated by `wp_nav_menu()`.
Continue reading Add human-readable classes to wp_nav_menu()
Add `fb:like:send=”true”` to the Facebook link in your AddThis button configuration. (Oh, and make sure you have `xmlns:fb=”http://www.facebook.com/2008/fbml”` in your `html` tag.)
[Unsupported and experimental, but works for me.](http://www.addthis.com/forum/viewtopic.php?f=8&t=31090&sid=6e3f7d7183ccde9dacd2abc21619eeec)
In a WordPress multisite installation, users were customizing their meta box configuration in the Screen Options tab (including boxes for various plugins) and having the settings disappear[^1][^2] between sites because WPMS has per user–not per user, per site–options for customizing the Dashboard and Screen Options.
I ended up writing the following plugin to create a series of shadow screen options for each user. This is reasonable on multisite installs with a finite number of users and blogs. If you are not concerned with the number of rows added per user, per blog, then this will allow your users to set Screen Options on a per blog basis. This is especially relevant on multisite installs where blogs have different uses and the active plugin set differs between blogs. Screen Options for plugin-generated meta boxes will be saved on a per site basis for each user, allowing them to retain their Add New/Edit Post appearance on each separate blog.
[Shadow Screen Options](http://wordpress.org/extend/plugins/shadow-screen-options/)
[^1]: [Per user screen options overwrite per site custom meta boxes](http://wordpress.org/support/topic/per-user-screen-options-overwrite-per-site-custom-meta-boxes)
[^2]: [Screen options and meta box settings can lose per-blog meta box positions](http://core.trac.wordpress.org/ticket/17370)
Between WordPress 3.0 and WordPress 3.1, code was added to change certain characters in image captions into their HTML/ASCII character code equivalents. However, some people like to include links in captions, and this new filter broke that ability by swapping valid link code (albeit with strict limitations on the use of single and double quote characters) for HTML characters.
Continue reading Unfilter links in captions in the WordPress Add Image dialogue