Support » Plugin: Thumb Fixer for Facebook » 1.7 breaks shortcode processing in page body

  • Resolved stucyber


    Hi Michael,

    first of all thanks for developing and maintaining your useful plugin. After updating to 1.7 I made some Facebook related offline tests and could not find any issues, so i gladly updated on my life site. Now, some days later and with your new updates coming up, I realized that already with 1.7 processing of my shortcodes in the page body stopped. After deactivating Facebook Thumb Fixer everything works fine again. I did some testing and could find the regression dating back to 1.7, 1.6 still works for me.
    Affected shortcodes are: All-in-one-event-calendar and some via functions.php manually registered code block deriving from Jetpack. I’m using the customizr theme.
    You can watch the issue yourself at I did not revert back to 1.6. online to give you the chance to have a look, so far I’m not losing any vital content here.

    Thanks for paying attention and good luck

    • This topic was modified 1 year, 8 months ago by  stucyber. Reason: typo
Viewing 10 replies - 16 through 25 (of 25 total)

  • I’m using Divi theme and before it would pull the text directly from the content.. Now it shows the shortcodes.. If I add an excerpt it works, but I want it to pull the first few lines from the content of the post like it was before.

    • This reply was modified 1 year, 8 months ago by  .
    Plugin Author Michael Ott


    Yes, it appears you’re correct (by chance I happen to have a client with that theme and I tested just now after I saw your comment).

    For whatever reason the Divi theme is not honouring the WordPress strip_shortcodes() function. Yet for every other random theme that I have tried, it is working as expected. But Divi just insists on ignoring the function and outputting the shortcode still.

    It would be poor form of me to bake in some code specifically just to fix the issue for Divi, and I can’t go back to ‘like it was before’ because that had it’s own set of problems I was made aware of last week (now fixed).

    So with that in mind I wouldn’t hold my breathe waiting for me to fix this because I honestly don’t known if and when I’ll get my next chance. As much as this issue is intriguing, I just can’t justify the time spend right now.

    I suggest trying an alternative plugin for your Facebook thumbnail requirements. I’m sure there must be some alternatives.

    Sorry about that. But good luck!

    PS: I will update the FAQ with this as a known issue.

    I like your plugin, so I’ve decided to fix it for myself and anyone else having this problem with Divi theme.

    So in the first if/else statement under apply_filters(). Add in the regular expression. It removes all content that begins with [et_pb and ends with the closing square bracket.

    if($post_page_description) {
        $post_page_description = $post_page_description;
    } else {
        $post = get_post($post->ID);
        $content = apply_filters('get_the_content', $post->post_content);
        $content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
        $content_chars = substr($content, 0, 300);
        $page_description = strip_tags($content_chars);
        $post_page_description = str_replace(array("\n", "\t", "\r"), '', $page_description);
    Plugin Author Michael Ott



    Props on the regular expression work – that’s something I’ve not had any experience with.

    Kind of edge case, but what would happen if someone actually had a [ or ] characters in the content that weren’t shortcodes?

    • This reply was modified 1 year, 8 months ago by  Michael Ott.

    It will only select [et_pb] tags.. if perhaps words are wrapped like this [random words] they will stay as is.

    I’ve added an example that shows a word wrapped in square brackets.

    • This reply was modified 1 year, 8 months ago by  .

    So in case someone uses other shortcodes than [et_pb...] the problem is still there? That would mean your solution with RegEx-replace is case specific and not globally applicable as an update. Or can you also build a RegEx wich can “distinguish” shortcodes from text in brackets?

    Regards, david

    Ok done.

    $content = preg_replace('/\[.*?\]/', '', $content);

    Just replace that line of code I added with this.

    • This reply was modified 1 year, 8 months ago by  .

    $content = preg_replace('/\[.*?\]/', '', $content);

    I would definitely not recommend that… it will replace all characters within square brackets. Unfortunately the real WP shortcode syntax is much more complex.

    It also doesn’t account for shortcodes that wrap text, in this instance it would remove the shortcodes but leave the innertext, eg.

    [bold]test text[/bold] or [link href="#"]link anchor[/link]

    • This reply was modified 1 year, 8 months ago by  aoverton.
    • This reply was modified 1 year, 8 months ago by  aoverton.
    • This reply was modified 1 year, 8 months ago by  aoverton.
    • This reply was modified 1 year, 8 months ago by  aoverton.

    So instead of removing them, why not just parse them? That gets you the intended content to be shortened anyway, no?

    Well, it’s doing what I need it to do on the site i’m working on. The first and 2nd change I posted. I haven’t had any problems, then again I haven’t tested for every possible angle this can break at.

    For a perfect global fix I’d need to spend more time on it or if anyone else has time to finish what was started.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘1.7 breaks shortcode processing in page body’ is closed to new replies.