Take filter from multiple functions

You can return $html[‘abc’] and add $html as parameter in each function and to the filter. Exemple for the function: function second_callback($html){ $html[‘def’]= ‘uvw’; return $html[‘def’]; }

Why this remove empty paragraphs from the_content does not works?

It’s not working because: Maybe your filter is running to early as Benoti said in his comments, your filter callback may run before the empty paragraphs are added. Maybe you are dealing with something different than am empty <p></p>, think <br>, &nbsp;… Solution 1: Disable autop (remove it’s filter). Solution 2: add_filter(‘the_content’, ‘wpse_244389’); function wpse_244389($content) … Read more

add_filter not working inside if function

No need to write this too much code. $pagePath = parse_url( $_SERVER[‘REQUEST_URI’] ); $pagePath = $pagePath[‘path’]; $pagePath = substr($pagePath, 1); you can easily get current page path by calling global variable $pagenow. global $pagenow; // return ‘post-new.php’ Instead of using content_save_pre filter you can do this same with wp_insert_post_data filter more easily. try out this. … Read more

List all image sizes still getting disabled sizes

Have a look into the get_intermediate_image_sizes function code solves your question: /** * Gets the available intermediate image sizes. * * @since 3.0.0 * * @global array $_wp_additional_image_sizes * * @return array Returns a filtered array of image size strings. */ function get_intermediate_image_sizes() { global $_wp_additional_image_sizes; $image_sizes = array(‘thumbnail’, ‘medium’, ‘medium_large’, ‘large’); // Standard sizes … Read more

Remove the post_content search from WHERE clause (and CONCAT sql function)

First look how complex is your preg replace. Usually, you may get into errors with that. NODE EXPLANATION ——————————————————————————– / “https://wordpress.stackexchange.com/” ——————————————————————————– \( ‘(‘ ——————————————————————————– \s* whitespace (\n, \r, \t, \f, and ” “) (0 or more times (matching the most amount possible)) ——————————————————————————– post_title ‘post_title’ ——————————————————————————– \s+ whitespace (\n, \r, \t, \f, and ” … Read more

Hook inside a hook

OK, so the new_to_publish hook is probably not the right hook to use here. The status_to_status hooks run during a posts transition from the first status to the second. By this stage, the editor is no longer in play. If my understanding of the_editor_content is correct, this filters the default content displayed in the editor … Read more

Can’t set properly WordPress add_filter function

Here’s the solution! function woocompare_button_icon( $html, $classes, $id, $nonce, $text, $preloader ) { return sprintf( ‘<button type=”button” class=”%s” data-id=”%s” data-nonce=”%s”><i class=”fa fa-heart-o” aria-hidden=”true”></i> %s</button>’, implode( ‘ ‘, $classes ), $id, $nonce, $text . $preloader ); } add_filter( ‘tm_woocompare_button’, ‘woocompare_button_icon’, 10, 6);