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

I have a problem with this -probably- abandoned plugin:

Plugin Name: RV Embed PDF
Description: When you upload PDF and insert a link to it with the Add Media button, it     will be automatically embedded in the page using Google Docs Viewer.
Author: Rong Vang Media
Author URI: http://www.rongvang.cz
Version: 1.0
function rv_embedpdf($in){
$out = "";
if(preg_match("/href='(.*?\\.pdf)'/", $in, $matches)){
    $out .= '<iframe src="http://docs.google.com/gview?url='.$matches[1].'&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>';

$out .= $in;

return $out;
add_filter ( 'media_send_to_editor', 'rv_embedpdf' );

can anybody help me to make it compatible with wp 3.5?

share|improve this question

'media_send_to_editor works fine in WordPress 3.5. I did not test the above code but you don't need to preg_match for .pdf when WordPress supports post_mime_type == 'application/pdf;

This should work better: https://gist.github.com/2176359
Just change the HTML parameters to your needs. I also advise to embed it directly as an <iframe>, native .pdf iframe browser support is better than sending it through docs.google.com.

share|improve this answer
[plugin author] Thanks, hotfix based on Wyck's help and linked plugin. Will update the plugin soon, thanks for suggestion. wordpress.org/support/topic/… – premek.v Dec 26 '12 at 11:20

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.