Filter a pluggable function

As noted in @Milo’s comment, a function being “Pluggable” is entirely separate from it being filterable. A Pluggable function can be overridden wholesale, because of the if ( function_exists() ) conditional in which it’s wrapped. A Plugin is filterable if its output is parsed through an apply_filters() call. Since you only want to change a … Read more

Regarding post text filtering

The usual way to show the post content, within the loop, is to use: the_content(); that will echo the output, not return it like get_the_content(). But since you want to assign it to the $text variable, you use: $text = get_the_content(”); but then the the_content output filter is not applied. That’s the reason why you … Read more

How to filter bbPress replies (content)?

The solution found: add_filter(‘bbp_get_topic_content’, ‘custommm_functiooonn’); add_filter(‘bbp_get_reply_content’, ‘custommm_functiooonn’); function custommm_functiooonn($content){ return ‘hiiiiiiii’.$content; }

Change the template when the user is not logged in using page_template filter (it does not work)

Your code doesn’t really do any “user logged in” check, and you aren’t using a couple of the globals you import. function restrict_access_to_unlogged_users($template) { if (!is_user_logged_in()) { $template = get_stylesheet_directory() . ‘/need-login.php’; } return $template; } add_filter( ‘page_template’, ‘restrict_access_to_unlogged_users’, 20 ); And you could do this more globally with template_include. function restrict_access_to_unlogged_users($template) { if (!is_user_logged_in()) … Read more

term_link filter gives less atributes

You need to add the the fourth parameter, $accepted_args, to add_filter() to access the second and third parameters in your callback function. Only the first parameter ($url) is passed by default. add_filter( ‘term_link’, ‘authorsongsurl’, 10, 3 ); The 3 in the end tells the filter to provide all the three parameters to your function.

run shortcode in excerpt of single custom post type

You just forgot to return the excerpt for the other post types. Try for example: function do_my_shortcode_in_excerpt( $excerpt ) { if ( ‘services’ == get_post_type() ) $excerpt = do_shortcode( wp_trim_words( get_the_content(), 55 ) ); return $excerpt; } add_filter( ‘get_the_excerpt’, ‘do_my_shortcode_in_excerpt’ );

Avoid user registrations with specific email provider

See this hook: register_post add_action(‘register_post’, ‘ban_email_2334’, 10, 3); function ban_email_2334( $username, $email, $errors ){ $result = array(); // check if email is from the provider you wish to ban preg_match(‘/bannedprovider.com/i’, $email, $result); if( !empty( $result )){ $errors->add(‘spam_email’, __( ‘Some choicest abuses you might want to pass on’ )); } return; } This will throw an … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)