Use has_filter on comment_post

You’re adding the action on comment_form_before_fields in comment_form_logged_in_after. The latter is called only when the user is logged in, and the former is only called when the user is not logged in. You can add WordPress actions and filters at any time after WordPress is initialized. If you’re adding the action in a plugin, add … Read more

How to filter Sidebar Content

There is no clean way to filter whole sidebar and such, but then that’s not what you really need. The calendar widget (assuming you mean native one) uses get_calendar() function, which passes result through get_calendar filter. It would be preferable to filter its queries, but from quick look at the code they seem highly messy … Read more

change “missing attachment” text functions.php

You should never change a core file. This message is called by the function wp_get_attachment_link(). For this singular message this function does not apply a filter, but it return the string as value, which can help. You can simple identify where in your theme this function is called and change it return, like: $result = … Read more

WP 4.5 hide core customizer sections

If you check out the source of WP_Customizer, you’ll see there is no title_tagline or header_image at the time the filter runs: final class WP_Customize_Manager { protected $components = array( ‘widgets’, ‘nav_menus’ ); public function __construct() { // a bunch of requires $components = apply_filters( ‘customize_loaded_components’, $this->components, $this ); } } Use the customize_register hook … Read more

I need to hook and change language of facebook sdk

Check the documentation of add_filter() first argument is name of filter and second one is callback function name. (both are required) See the example for your case:- add_filter(‘bimber_facebook_sdk_src’, ‘change_fb_sdk_url’); function change_fb_sdk_url($current_url) { // Variable $current_url hold the current value of URL // You can manipulate what you want // Or simply return your URL return … Read more

Problem with images URL after filter applying

<?php $string = ‘Sentence 1. Sentence 2? Sentence 3! Sentence 4… Sentence 5… Sentence 6! Sentence 7. Sentence 8. Sentence 9… Sentence 10… Sentence 11. ‘; $sentences_per_paragraph = 3; // settings $pattern = ‘~(?<=[.?!…])\s+~’; // some punctuation and trailing space(s) $sentences_array = preg_split($pattern, $string, -1, PREG_SPLIT_NO_EMPTY); // get sentences into array $sentences_count = count($sentences_array); // … Read more