The quest continues

Why haven’t you been posting new filters? Don’t tell me you flaked out after only 25 …

y_u_no_post_filtersHave no fear, I don’t plan to give up anytime soon. For personal reasons, I had to take a few days off, but posting will resume its usual fervor this weekend. I’m discovering more and more that you do the things you need to do before you can do the things you want to do.

Which brings me to my next point: I’ve decided to take a bit of a different tack on this project going forward.

I’m still planning to try documenting (at least) three filters a day, but I’m going to adopt a much more structured format:

  • The randomized master list is going away and I’ll instead be going file by file through core
  • Posts will be more succinct, less focused on where filters are located and their history, and more focused on their purpose and what arguments they accept
  • Whenever possible, there will still be examples with every post

Partly the reasoning for these changes is so that it takes me less time to document each filter, and partly it’s due to some exciting code documentation plans shaping up for the 3.7 cycle. Keep an eye peeled for more on that second part soon.

Next up: wp-admin/includes/ajax-actions.php

Week 1 Recap: Filters 1-12

Just in case you missed any of the filters posted this week, I decided to do a short recap. This week we covered filters 1-12 from the master list. Next week we’ll be making up a few filters missed this weekend while I was off the radar.

#1: pre_comment_author_name

This filter allows you to modify a comment author’s name before the comment is created or updated. The example covered prepending text to comment author names for administrators.

#2: dashboard_primary_title

This filter allows you to modify the title of the ‘WordPress Blog’ dashboard widget when WordPress is initially installed. This type of filter only really has a one-time use since users can adjust the widget title and the filter no longer has any effect.

#3: wpmu_signup_user_notification

This filter is used to determine whether a confirmation email should be sent for new user signups in Multisite. The example covered disabling confirmation emails to anyone who had a Gmail email address.

#4: the_weekday_date

This filter makes it possible to change the displayed day of the week a post was published, when the function of the same name, the_weekday_date() is used inside the Loop. The example covered converting the word “Saturday” into pirate-speak.

#5: post_row_actions

This filter allows you to modify the row action links in the non-hierarchical post types list table, links like ‘Edit’, ‘Quick Edit’, ‘Trash’, and ‘Preview’. The example covered removing the ‘Quick Edit’ link for posts.

#6: wp_terms_checklist_args

This filter allows you to modify the arguments array in wp_terms_checklist(), the function that displays hierarchical taxonomies in a tiered, checklist form. The example covered how to keep the selected terms from appearing at the top of the checklist.

#7: post_comments_feed_link

This filter allows you to modify the comments feed URL for the current page or post. The example covered changing the URL scheme — such as changing from http to https — of the comments feed link.

#8: get_the_generator_{$type}

This filter allows you to modify the generator meta tag provided by WordPress in certain contexts. The example covered how to convert the WordPress version number into the name of the jazz musician for its corresponding release. In other words, fun with filters!

#9: teeny_mce_buttons

This filter allows you to add or remove buttons from the teeny mce buttons row used in Press This. The example covered registering a new button for the teeny mce bar.

#10: posts_join_paged

This filter allows you to add SQL join(s) to the posts query in paginated contexts. There is no example for this one yet. Have an idea? Submit an example.

#11: http_response

This filter makes it possible to manipulate the response array returned by a wp_remote_request() call. The example covered returning canned body content for requests with status codes other than 200, 301, or 302.

#12: protected_title_format

This filter allows you to modify the text that gets prepended to a post title if it is password protected. The example covered converting the default ‘Protected: [Post Title]’ prefix text to ‘Members Only: [Post Title]’.