The Stack Overflow podcast is back! Listen to an interview with our new CEO.
2 added 496 characters in body
source | link

From the comments the remove_filter is called too early before the core add_filter is called. Best way to avoid this is to always remove nd add your filter at the init action

add_action('init','wpse163434_init');

function wpse163434_init() {
  remove_filter.....
  add_filter.....
}

This way you are assure that the core had finished initializing and all the core actions and filters are already set.

Update: all of the above is nice and true, but there is no software without bugs and apparently some filters are added in places where it is really hard to remove them without feeling it is too much off a hack, and image_send_to_editor is one of them.

Luckily that filter applies the image_add_caption_shortcode filter and passes the original html to it so instead of removing image_send_to_editor you might get the same impact by using the image_add_caption_shortcode filter.

From the comments the remove_filter is called too early before the core add_filter is called. Best way to avoid this is to always remove nd add your filter at the init action

add_action('init','wpse163434_init');

function wpse163434_init() {
  remove_filter.....
  add_filter.....
}

This way you are assure that the core had finished initializing and all the core actions and filters are already set.

From the comments the remove_filter is called too early before the core add_filter is called. Best way to avoid this is to always remove nd add your filter at the init action

add_action('init','wpse163434_init');

function wpse163434_init() {
  remove_filter.....
  add_filter.....
}

This way you are assure that the core had finished initializing and all the core actions and filters are already set.

Update: all of the above is nice and true, but there is no software without bugs and apparently some filters are added in places where it is really hard to remove them without feeling it is too much off a hack, and image_send_to_editor is one of them.

Luckily that filter applies the image_add_caption_shortcode filter and passes the original html to it so instead of removing image_send_to_editor you might get the same impact by using the image_add_caption_shortcode filter.

1
source | link

From the comments the remove_filter is called too early before the core add_filter is called. Best way to avoid this is to always remove nd add your filter at the init action

add_action('init','wpse163434_init');

function wpse163434_init() {
  remove_filter.....
  add_filter.....
}

This way you are assure that the core had finished initializing and all the core actions and filters are already set.