Can the wp_filter object hold multiple values with the same key

Firstly, keep in mind that the structure of $wp_filter was changed in WordPress 4.7: https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/ As for your questions: Is this possible? Yes. Under what circumstances would this occur? If multiple functions have been hooked to the same action/filter, eg: add_action( ‘save_post’, ‘do_a_thing’ ); add_action( ‘save_post’, ‘do_another_thing’ ); In that case $wp_filter[‘save_post’] will have multiple … Read more

When adding buttons to the tinyMCE editor, how do I make them wrap to the next line and/or display in the “Kitchen Sink” area?

I imagine you’re also adding a filter mce_buttons to add in the button to, something like.. add_filter( ‘mce_buttons’, ‘add_my_tinymce_buttons’ ); function add_my_tinymce_buttons( $items ) { $items[] = ‘your-button’; return $items; } Just change the filter to hook onto mce_buttons_2 instead, and the button will appear on the second row , eg.. add_filter( ‘mce_buttons_2’, ‘add_my_tinymce_buttons’ ); … Read more

Filter my args by the post 1st letter

To restrict to letter X dynamically, the following should work. It depends upon the fact that WP_Query will let ad hoc parameters pass through. That lets you send your own data to the filters. I do not know if this is intentional behavior so caveat emptor, but it is very useful behavior. Simply send your … Read more

How to center oEmbedded content

After some Googling, I found a solution that was originally done for a Twitter embed, but I modified it to work with all oEmbed contents. Keep in mind that for this to work on existing posts, you’ll need to do an “update” for the oEmbed content to refresh from the cache. add_filter(‘oembed_result’,’center_oembed’,10,3); function center_oembed($html, $url, … Read more

remove_action in plugin file

Make sure you remove the action after the theme has added it. And use the same priority. A rather safe way is using the same action you want to clean up: add_action( ‘admin_notices’, ‘remove_woothemes_updater_notice’, 0 ); function remove_woothemes_updater_notice() { remove_action( ‘admin_notices’, ‘woothemes_updater_notice’ ); }