WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

the idea is apply some filters if the user select the option in the theme, but i have a problem

i made a function that replace the post_thumbnail_html for a personalized html

then, i create other function that create thumnails for timthumb

i'm trying to apply the add_filter to the timthumb function, but it doesn't work because is not a wordpress hook

can you helpme?

function kandombe_theme_thumb($id, $width, $height, $align='') {

        //some code

        $html = '<img class="archive_thumb" src='.$image_url.' width="'.$width.'" height="'.$height.'"/>';

        return $html;


if ($data['speed_lazy_loading']) { 

    function kandombe_lazy_loads( $html ) {

        //some code

        $html = preg_replace( '#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', sprintf( '<img${1}src="%s" data-original="${2}"${3} style="display: block;"><noscript><img${1}src="${2}"${3}></noscript>', $placeholder_image ), $html );

    return $html;

add_filter( 'the_content', 'kandombe_lazy_loads');
add_filter( 'post_thumbnail_html', 'kandombe_lazy_loads');
add_filter( 'kandombe_theme_thumb', 'kandombe_lazy_loads');
add_filter( 'get_avatar', 'kandombe_lazy_loads');

share|improve this question

Assuming that this-- add_filter( 'kandombe_theme_thumb', 'kandombe_lazy_loads');-- is the line/hook you are talking about.

You don't hook to functions. That is not how it works. Hooks have to be intentionally created with apply_filters or do_action. Your code would have to be written like this for that to work:

function kandombe_theme_thumb($id, $width, $height, $align='') {
    //some code
    $html = apply_filters(
      '<img class="archive_thumb" src='.$image_url.' width="'.$width.'" height="'.$height.'"/>'
    return $html;



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.