arguments for comment_notification_text filter

For the arguments, check the source: $notify_message = apply_filters( ‘comment_notification_text’, $notify_message, $comment_id ); You have two parameters. The first is the notification text itself, prior modification by your filter. It is constructed earlier in the same function and is different for comments, trackbacks, and pingbacks. The second parameter, as you might guess from the name, … Read more

Plugin default settings hook

I’d use a filter. You can remove this: if (function_exists(‘bf_new_defaults’)) { return bf_new_defaults( $default_settings ); } else { return $default_settings; } and replace it with something like this: return apply_filters(‘bf_filter’, $default_settings) The following is a truncated, proof of concept version of the code so you can see how $default_settings gets altered. add_filter( ‘bf_filter’, function($default_settings) { … Read more

Add Filter – Pass Variable (PHP < 5.3)

You could try something like the second option, but I think it would be overkill. Instead, just write your own custom analog to wp_trim_excerpt() (the function that applies the excerpt_length and excerpt_more filters to the excerpt), like so: function custom_excerpt( $new_length = 20, $new_more=”…”, $strip = false ) { // Start with the content $text … Read more

Making an add_filter() call from within an add_filter() call

You can add or remove hooks from inside other hooks if you get the timing right but I don’t understand why you are making this so complex. function set_title($title) { global $wp_query,$post,$address; $address = $wp_query->query_vars[‘address’]; if ($address) { return $address; } } add_filter(‘wp_title’, ‘set_title’); If you need the share the value, use a static variable: … Read more

Filter / add_action to upgrade.php page

Well, the first lines of that file, not counting comments/headers, are… /** Include user install customize script. */ if ( file_exists(WP_CONTENT_DIR . ‘/install.php’) ) require (WP_CONTENT_DIR . ‘/install.php’); You could include a custom install script with the rest of your code. That seems the most straightforward approach to me. It is hard to say a … Read more

add after content don’t work

wb_posts_pagination() seems to be a custom function that sends its output directly to the browser with echo or print. Use a function that returns a string and does not create output to add that string to $content. The printed output doesn’t wait, it goes into the page the moment you call that function.

Is this hook really deprecated? ( manage_{$taxonomy}_custom_column )

manage_{$taxonomy}_custom_column is a dynamic hook, so until you are using a proper value for $taxonomy like post_tag, it would work perfectly. Adam Brown page tells it as deprecated because it looks for exact match, while there is a change in the files so the current hook being used are manage_{$this->screen->taxonomy}_custom_column or manage_{$screen->taxonomy}_custom_column which accepts the … Read more

What is the action or filter for adding information under the Permalink in Edit Post/Page?

You can try the edit_form_after_title action: add_action( ‘edit_form_after_title’, function(){ echo ‘<hr/><div>My custom HTML</div><hr/>’; }); to add your custom HTML after the permalink: It will inject the HTML between div#titlediv and div#postdivrich: <div id=”post-body-content”> <div id=”titlediv”>…<!– /titlediv –> <hr><div>My custom HTML</div><hr> <div id=”postdivrich” class=”postarea edit-form-section”>…</div> … </div> Tip: when you have question like this, best thing … Read more

Renaming wordpress login and get new password button

This is a bad idea for general usage plugin, unless you intend to supply translations for all the languages for which there is a wordpress translation. If you need a new login form then use new strings for the text, don’t override the string used in the wordpress login form, it give you no advantage … Read more