BuddyDev

Search

[Resolved] Is it possible to filter MediaPress share link preview

  • Participant
    Level: Enlightened
    Posts: 34
    Milan Latinovic on #29469

    Hi everyone,

    Currently, we have plugin that creates PDF files and that is ok. But, since this plugin loads at the beginning of the page, there is a text “Download this post in PDF format” when we share a page. This is not good because of two reasons: 1) it is a bad UX, 2) SEO reads this text each time, instead of getting meaningful content right away.

    How could we remove this text “Download this post in the PDF format” from the beginning of shared text?

    Is there some filter we can use? Could you provide us with snippet?

    Here is a screenshot of what we have now, where we selected part of the text that we want to remove from share.
    https://ibb.co/VQpDxd4

    Thank you very much!

    Kind regards,
    Milan

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #29482

    Hi Milan,
    Thank you for the question.

    Currently, the preview is generated by WordPress(as attachment preview).

    Still, your issue is not related to preview. The text “Download this post in the PDF format” seems to be generated by a plugin you are using.

    Are you using any plugin to generated pdf of a post? That seems to be doing it. You should report it to the plugin team as preview should not contain this message.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 34
    Milan Latinovic on #29498

    Hi Brajesh,

    Yes, we are using plugin that is generating text “Download this post in the PDF format” at the top of our posts. This is what we want and this text makes sense in posts.
    However, we don’t want it in a BuddyPress preview, when we share link.

    I will report this to the plugin creators as you suggested.

    However is there some mechanism to “filter out” this text?
    For example, if we can make some rule to tell WordPress remove “Download this post in the PDF format” text from the beginning of the attachment if available?

    When we report this to plugin creators it will take some time before they implement it for sure. That is why I am exploring possibility to fix this at the level of our site, with filters or other hooks.

    Kind regards,
    Milan

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #29501

    Hi Milan,
    the plugin is most probably using the_content to add that text. Also, It is not BuddyPress preview, It is the oembed preview.

    So, when asking for support, please ask them how to disable it in the oembed preview of the post.

    I will suggest waiting for the developers suggestion and see if they provide some filter.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 34
    Milan Latinovic on #29537

    Hi Brajesh,

    Sadly, DK PDF plugin is no longer supported, so there is nobody I could communicate with.

    However, I did my own research and found a working solution.
    I will share it here, maybe somebody will find it useful.

    function modify_excerpt_embed( $output ) {
    	if(is_plugin_active("dk-pdf/dk-pdf.php")) {
    		// Here you can write any modifications to embed excerpt that you want to
    	}
    	return $output;
    }

    So, I am using WordPress hook “modify_exceprt_embed” to modify excerpt, but I am only doing this if DK PDF plugin is active. This way, when we remove this plugin my filter will no longer be active.

    This is what I wanted to do in the beginning, find some filter that is good for changing embed output.

    Thanks for providing me with additional information.
    It was pleasure as always. 🙂

    All best,
    Milan

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #29543

    Thank you for sharing Milan.

    I am glad you found the solution 🙂

    Regards
    Brajesh

The topic ‘ [Resolved] Is it possible to filter MediaPress share link preview’ is closed to new replies.

This topic is: resolved