Auto Post Thumbnail
Adding Shortcode (1 post)

  1. Travis Smith
    Posted 5 years ago #

    Recently I used this plugin and Auto Featured Image, but both didn't do what I wanted them to do.

    So investigating their code, they were only searching the content pre-shortcode execution. So if anyone is using a shortcode to post images or videos, then this plugin wasn't working so well.

    So for Auto Post Thumbnail, in the file auto-post-thumbnail.php, if you insert
    $post_content = do_shortcode($post[0]->post_content); above preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches); and change preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches); to preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post_content, $matches); then it will execute shortcodes before assigning the post thumbnail. This is important for those who use shortcodes to display images (or even videos in Auto Featured Image Plugin).

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Auto Post Thumbnail
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic