Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#39741 closed defect (bug) (invalid)

Hook of 'media_send_to_editor' filter causes no output.

Reported by: slancio's profile slancio Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Editor Keywords:
Focuses: Cc:

Description

I have a site there I'm trying to make modifications to the HTML returned when uploading images in a post via the Add Media button.

Just the act of hooking that filter seems to cause the Add Media button to output no HTML whatsoever . I am passing $html, $send_id, and $attachment to my hook function and returning $html.

Interestingly enough, the body of the function seems to not run. I've tried setting debugger lines within the function, vardump the input variables, even exit(). Nothing seems to happen within the function body, xdebug doesn't kick off within the function body and no output is returned either. Once I remove the hook, everything seems to work fine again.

This happens on a fresh install of 4.7.2 I also tried this on 3 other WordPress site installs that I have in production versions 4.5 and later and experience the same behavior.

Change History (4)

#1 @SergeyBiryukov
7 years ago

  • Keywords reporter-feedback added

Hi @slancio, welcome to Trac! Thanks for the report.

I could not reproduce the issue on a clean install, media_send_to_editor filter works as expected for me.

Could you provide an example code of the function you're using?

#2 @slancio
7 years ago

I've made it as simple as

function filter_media_send_to_editor( $html, $id, $attachment ) {
  return $html;
}

add_filter( 'media_send_to_editor', 'filter_media_send_to_editor', 10, 3 );

in functions.php. No output. If I set a breakpoint within the body of that function, my debugger doesn't catch it. The only other thing unusual about my setups that I can think of is that all of my WordPress installs are on Vagrant boxes or Homestead.

#3 @slancio
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Closing. Figured out this is totally an issue on our end. We have multiple vagrant boxes on the same system and whatever was getting returned was going to the a different wordpress install/vagrant box.

Going to chalk it up to a configuration error on our end. Sorry for the inconvenience.

#4 @SergeyBiryukov
7 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

All good, thanks for the follow-up!

Note: See TracTickets for help on using tickets.